Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/setup-gcp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ echo ""
# workspace-server/src/features/feature-config.ts. See issue #323.
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
SCOPES_OUTPUT=$(cd "$REPO_ROOT" && npx --no-install ts-node --transpile-only scripts/print-scopes.ts 2>&1)
SCOPES_OUTPUT=$(cd "$REPO_ROOT" && npx --no-install ts-node --transpile-only --project scripts/tsconfig.json scripts/print-scopes.ts 2>&1)
if [ $? -ne 0 ]; then
echo -e "${RED}Error: Failed to compute OAuth scopes from feature-config.ts.${NC}"
echo -e "${RED}Did you run 'npm install' at the repo root?${NC}"
Expand Down
7 changes: 7 additions & 0 deletions scripts/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "../tsconfig.json",
"compilerOptions": {
"rootDir": ".."
},
"include": ["**/*.ts", "../workspace-server/src/**/*"]
}
4 changes: 2 additions & 2 deletions skills/google-docs/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,15 +236,15 @@ the destination by folder ID or folder name.

### Reading Comments

Use `docs.getComments` to retrieve all comments on a document:
Use `drive.getComments` to retrieve all comments on a document:

- Returns comment threads with author, content, timestamp, and resolution status
- Includes **threaded replies** with author, content, timestamp, and action
(e.g., `resolve`, `reopen`)
- Includes **quoted file content** showing what text the comment is anchored to

```
docs.getComments({ documentId: "doc-id" })
drive.getComments({ fileId: "doc-id" })
```

### Reading Suggestions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ describe('getAllPossibleScopes (issue #323)', () => {
// execSync (not execFileSync) so Windows can resolve npx.cmd via the
// shell. Tests run on ubuntu/macos/windows.
const output = execSync(
'npx --no-install ts-node --transpile-only scripts/print-scopes.ts',
'npx --no-install ts-node --transpile-only --project scripts/tsconfig.json scripts/print-scopes.ts',
{ cwd: repoRoot, encoding: 'utf8' },
);
const printed = output.trim().split(/\r?\n/);
Expand Down
12 changes: 9 additions & 3 deletions workspace-server/src/__tests__/services/DocsService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
beforeEach,
afterEach,
} from '@jest/globals';
import { DocsService } from '../../services/DocsService';
import { DocsService, TABS_FIELD_MASK } from '../../services/DocsService';
import { AuthManager } from '../../auth/AuthManager';
import { google } from 'googleapis';

Expand Down Expand Up @@ -465,6 +465,12 @@ describe('DocsService', () => {

const result = await docsService.getText({ documentId: 'test-doc-id' });

expect(mockDocsAPI.documents.get).toHaveBeenCalledWith({
documentId: 'test-doc-id',
fields: `title,${TABS_FIELD_MASK}`,
includeTabsContent: true,
suggestionsViewMode: 'PREVIEW_WITHOUT_SUGGESTIONS',
});
expect(result.content[0].text).toBe('Hello World\n');
});

Expand Down Expand Up @@ -845,7 +851,7 @@ describe('DocsService', () => {

expect(mockDocsAPI.documents.get).toHaveBeenCalledWith({
documentId: 'test-doc-id',
fields: 'tabs',
fields: TABS_FIELD_MASK,
includeTabsContent: true,
});

Expand Down Expand Up @@ -922,7 +928,7 @@ describe('DocsService', () => {

expect(mockDocsAPI.documents.get).toHaveBeenCalledWith({
documentId: 'test-doc-id',
fields: 'tabs',
fields: TABS_FIELD_MASK,
includeTabsContent: true,
});

Expand Down
13 changes: 10 additions & 3 deletions workspace-server/src/services/DocsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ import { extractDocId } from '../utils/IdUtils';
import { gaxiosOptions } from '../utils/GaxiosConfig';
import { extractDocumentId as validateAndExtractDocId } from '../utils/validation';

// Field mask for documents.get when reading tab content. Selects only the
// structural fields we use; broader masks like 'tabs' alone trigger
// "comment-specific fields" errors when combined with includeTabsContent.
export const TABS_FIELD_MASK =
'tabs(tabProperties,documentTab(body,headers,footers,footnotes))';

interface BaseDocsSuggestion {
text: string;
startIndex?: number;
Expand Down Expand Up @@ -307,7 +313,7 @@ export class DocsService {
// Discover the end index by reading the document (required for tabs)
const res = await docs.documents.get({
documentId: id,
fields: 'tabs',
fields: TABS_FIELD_MASK,
includeTabsContent: true,
});

Expand Down Expand Up @@ -543,8 +549,9 @@ export class DocsService {
const docs = await this.getDocsClient();
const res = await docs.documents.get({
documentId: id,
fields: 'title,tabs', // Request title and tabs (body is legacy and mutually exclusive with tabs in mask)
fields: `title,${TABS_FIELD_MASK}`,
includeTabsContent: true,
suggestionsViewMode: 'PREVIEW_WITHOUT_SUGGESTIONS',
});

const docTitle = res.data.title;
Expand Down Expand Up @@ -736,7 +743,7 @@ export class DocsService {
// Get the document to find where the text will be replaced
const docBefore = await docs.documents.get({
documentId: id,
fields: 'tabs',
fields: TABS_FIELD_MASK,
includeTabsContent: true,
});

Expand Down
Loading