@genspark/cli 1.13.0 → 1.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -7
- package/dist/client.d.ts +14 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +62 -2
- package/dist/client.js.map +1 -1
- package/dist/commands/aidrive-operands.d.ts +29 -0
- package/dist/commands/aidrive-operands.d.ts.map +1 -0
- package/dist/commands/aidrive-operands.js +178 -0
- package/dist/commands/aidrive-operands.js.map +1 -0
- package/dist/commands/aidrive-upload.d.ts +149 -0
- package/dist/commands/aidrive-upload.d.ts.map +1 -1
- package/dist/commands/aidrive-upload.js +344 -0
- package/dist/commands/aidrive-upload.js.map +1 -1
- package/dist/commands/design.d.ts +9 -0
- package/dist/commands/design.d.ts.map +1 -1
- package/dist/commands/design.js +12 -2
- package/dist/commands/design.js.map +1 -1
- package/dist/commands/genteam-download.d.ts +34 -0
- package/dist/commands/genteam-download.d.ts.map +1 -0
- package/dist/commands/genteam-download.js +95 -0
- package/dist/commands/genteam-download.js.map +1 -0
- package/dist/config.d.ts +13 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +18 -0
- package/dist/config.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +477 -63
- package/dist/index.js.map +1 -1
- package/docs/skills.md +2 -2
- package/package.json +1 -1
- package/skills/gsk-aidrive/SKILL.md +232 -26
- package/skills/gsk-audio-generation/SKILL.md +1 -1
- package/skills/gsk-genteam/SKILL.md +3 -3
- package/skills/gsk-google-drive/SKILL.md +25 -6
- package/skills/gsk-google-sheets/SKILL.md +1 -1
- package/skills/gsk-meeting/SKILL.md +1 -0
- package/skills/gsk-second-brain/SKILL.md +87 -20
- package/skills/gsk-shared/SKILL.md +4 -2
- package/skills/gsk-slack/SKILL.md +10 -8
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as pathModule from 'path';
|
|
1
2
|
/**
|
|
2
3
|
* Pick the first operand that is an existing local file or directory.
|
|
3
4
|
*
|
|
@@ -7,6 +8,83 @@
|
|
|
7
8
|
* `collectUploadFiles` before each file is streamed.
|
|
8
9
|
*/
|
|
9
10
|
export declare function pickExistingUploadOperand(operands: readonly string[]): string | undefined;
|
|
11
|
+
/**
|
|
12
|
+
* Name the operands of `gsk drive upload <local> [<drive destination>]`.
|
|
13
|
+
* The local source is `--local_file` or else the first operand that exists
|
|
14
|
+
* on disk (none with `--file_content`); the destination is `--path`/`-p` or
|
|
15
|
+
* the operand left over. Before this, a destination operand was dropped and
|
|
16
|
+
* the file landed at the drive root. Anything ambiguous is refused, with
|
|
17
|
+
* nothing sent: a second destination beside `--upload_path`, a stray
|
|
18
|
+
* operand, a destination operand that also exists on this disk (which of
|
|
19
|
+
* the two is the upload?), and a disk's root as the local source. A drive
|
|
20
|
+
* spelling (`/mnt/aidrive/…`, `aidrive://…`) is never read off this disk:
|
|
21
|
+
* in a sandbox the drive itself is mounted there.
|
|
22
|
+
*/
|
|
23
|
+
export declare function resolveAidriveUploadOperands(opts: {
|
|
24
|
+
operands: readonly string[];
|
|
25
|
+
localFile?: string;
|
|
26
|
+
inline: boolean;
|
|
27
|
+
path?: string;
|
|
28
|
+
uploadPath?: string;
|
|
29
|
+
}): {
|
|
30
|
+
localFile?: string;
|
|
31
|
+
destination?: string;
|
|
32
|
+
error?: string;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* The destination operand that also exists on this disk, which makes it
|
|
36
|
+
* unclear which of two is the upload. With the source adopted from the
|
|
37
|
+
* operands, any operand on disk (but `/`) could be the upload; beside
|
|
38
|
+
* --local_file or inline content, a file is suspect, and so is a folder
|
|
39
|
+
* spelled as a local path (`./site`), while a folder like /tmp may well
|
|
40
|
+
* name a drive folder. A drive spelling (`/mnt/aidrive/…`) is never read
|
|
41
|
+
* off this disk: in a sandbox the drive itself is mounted there.
|
|
42
|
+
*/
|
|
43
|
+
export declare function operandOnDisk(operands: readonly string[], opts: {
|
|
44
|
+
adopted: boolean;
|
|
45
|
+
localFile?: string;
|
|
46
|
+
}, probe?: {
|
|
47
|
+
exists: (candidate: string) => boolean;
|
|
48
|
+
isFile: (candidate: string) => boolean;
|
|
49
|
+
}): string | undefined;
|
|
50
|
+
/** Whether a local path is the root of its disk: `/`, or `C:\\` on Windows,
|
|
51
|
+
* where `resolve('/')` is the drive root and a `=== '/'` test never matched. */
|
|
52
|
+
export declare function isDiskRoot(candidate: string, paths?: typeof pathModule): boolean;
|
|
53
|
+
/**
|
|
54
|
+
* A drive path as the upload endpoint takes it: `aidrive:///a/b`, the
|
|
55
|
+
* sandbox mount `/mnt/aidrive/a/b` and `/aidrive/a/b` all mean `/a/b`, as
|
|
56
|
+
* the tool lane reads them; the file lane stored them as literal folders.
|
|
57
|
+
* A URL is refused: a Drive link names a folder through `--url`, not as a
|
|
58
|
+
* path. So is a Windows drive path, which names this disk.
|
|
59
|
+
*/
|
|
60
|
+
export declare function normalizeUploadDestination(destination: string): {
|
|
61
|
+
path?: string;
|
|
62
|
+
error?: string;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Where an upload lands when its destination was an operand or `--path`:
|
|
66
|
+
* the folder that receives it (created if missing), unless the last name is
|
|
67
|
+
* the upload's own: the same name, or for a file one with the same
|
|
68
|
+
* extension, which renames it (`/Reports/q3-final.pdf`). A trailing `/`
|
|
69
|
+
* always means a folder. A last name with a different extension, or with
|
|
70
|
+
* one when the file has none, is refused: read as a folder it became
|
|
71
|
+
* `/Photos/beach.jpg/photo.jpeg`. The upload is named after its resolved
|
|
72
|
+
* local path, so `..` cannot collapse the destination.
|
|
73
|
+
*/
|
|
74
|
+
export declare function uploadPathForDestination(destination: string, localPath: string, isDirectory: boolean): {
|
|
75
|
+
uploadPath?: string;
|
|
76
|
+
error?: string;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* What is wrong with an upload's same-name answer, or '' when nothing: an
|
|
80
|
+
* unknown `--on-conflict` (the server read one as rename, so a typo landed
|
|
81
|
+
* a `name(1)` copy), and `--on-conflict overwrite` beside `--overwrite
|
|
82
|
+
* false`. Inline content has no rename: a taken name is refused or replaced.
|
|
83
|
+
*/
|
|
84
|
+
export declare function uploadConflictProblem(conflict: {
|
|
85
|
+
onConflict?: string;
|
|
86
|
+
error?: string;
|
|
87
|
+
}, args: Record<string, unknown>, inline: boolean): string;
|
|
10
88
|
export interface UploadFile {
|
|
11
89
|
absolutePath: string;
|
|
12
90
|
relativePath: string;
|
|
@@ -30,4 +108,75 @@ export declare function buildAidriveUploadQuery(opts: {
|
|
|
30
108
|
source?: string;
|
|
31
109
|
locator?: UploadLocator;
|
|
32
110
|
}): URLSearchParams;
|
|
111
|
+
/** How a same-name collision is answered on the streaming lane, from the
|
|
112
|
+
* three spellings a caller may use: the tool schema's `--overwrite true`
|
|
113
|
+
* (the one every prompt teaches), the CLI's older `--override` flag, and
|
|
114
|
+
* `--on-conflict error|rename|overwrite`. Overwrite keeps the entry's id,
|
|
115
|
+
* so its share link stays valid — the point of editing a file in place.
|
|
116
|
+
* Two spellings that disagree are refused rather than silently ranked:
|
|
117
|
+
* a renamed copy under a new id is exactly the outcome the caller was
|
|
118
|
+
* trying to avoid. The lane never forwards tool args, so `--overwrite`
|
|
119
|
+
* has to be read here. */
|
|
120
|
+
/** The lane's conflict answer read off what Commander parsed: `opts` holds
|
|
121
|
+
* the CLI-only flags (`--override`, `--on-conflict`), `args` the tool
|
|
122
|
+
* schema's (`--overwrite`, which Commander parses to a boolean). */
|
|
123
|
+
export declare function uploadConflictFromCli(opts: Record<string, unknown>, args: Record<string, unknown>): {
|
|
124
|
+
onConflict?: string;
|
|
125
|
+
error?: string;
|
|
126
|
+
};
|
|
127
|
+
/** The share args an upload carries along (`--to`, `--general_access`, …),
|
|
128
|
+
* or an empty object when the caller asked for no share. */
|
|
129
|
+
export declare function shareArgsFromUpload(args: Record<string, unknown>): Record<string, unknown>;
|
|
130
|
+
/** Why `--to` / `--general_access` cannot ride this upload, or '' when
|
|
131
|
+
* they can: the share verb the lane runs next is the My Drive one, so a
|
|
132
|
+
* shared destination (a workspace other than My Drive, a `--source`,
|
|
133
|
+
* which selects one whatever the workspace says, a folder id / URL,
|
|
134
|
+
* which may be anyone's, or a shared drive's web address) is refused up
|
|
135
|
+
* front — its sharing has its own verb and admin gate. A folder upload
|
|
136
|
+
* has no single file to share. */
|
|
137
|
+
export declare function uploadShareRefusal(opts: {
|
|
138
|
+
workspace: string;
|
|
139
|
+
source?: string;
|
|
140
|
+
addressedById?: boolean;
|
|
141
|
+
isDirectory: boolean;
|
|
142
|
+
uploadPath?: string;
|
|
143
|
+
}): string;
|
|
144
|
+
interface ToolReply {
|
|
145
|
+
status: 'ok' | 'error';
|
|
146
|
+
message: string;
|
|
147
|
+
data: unknown;
|
|
148
|
+
session_state?: Record<string, unknown> | null;
|
|
149
|
+
}
|
|
150
|
+
/** One reply for "uploaded, then shared": the share's human summary joins
|
|
151
|
+
* the upload message (replacing the upload's "share it like so" hint,
|
|
152
|
+
* which the share just did), and its structured answer rides in
|
|
153
|
+
* `data.share`. A share failure keeps the upload result — the file is
|
|
154
|
+
* there, so the reply stays `ok` (an `error` would send a retrying agent
|
|
155
|
+
* back through the upload, landing a second copy) and `data.share.status`
|
|
156
|
+
* plus the message say the sharing failed. A tool reply carries its
|
|
157
|
+
* summary in `data.result` and the structured answer in
|
|
158
|
+
* `session_state.aidrive_result`. */
|
|
159
|
+
export declare function mergeShareIntoUpload(upload: ToolReply, shared: ToolReply): ToolReply;
|
|
160
|
+
export declare function resolveUploadConflict(opts: {
|
|
161
|
+
override?: boolean;
|
|
162
|
+
overwrite?: boolean;
|
|
163
|
+
onConflict?: string;
|
|
164
|
+
}): {
|
|
165
|
+
onConflict?: string;
|
|
166
|
+
error?: string;
|
|
167
|
+
};
|
|
168
|
+
/**
|
|
169
|
+
* Headers for the raw streaming AI Drive upload. This lane bypasses
|
|
170
|
+
* ApiClient (it streams the file body itself), so it must pick the request
|
|
171
|
+
* credential the same way: the per-turn `GSK_TURN_TOKEN` when present, else
|
|
172
|
+
* the api key — `aidrive` is owner-gated, and without the turn credential a
|
|
173
|
+
* parallel-turn sandbox would be denied as unattributable.
|
|
174
|
+
*/
|
|
175
|
+
export declare function aidriveUploadHeaders(opts: {
|
|
176
|
+
apiKey?: string;
|
|
177
|
+
projectId?: string;
|
|
178
|
+
contentType: string;
|
|
179
|
+
env?: NodeJS.ProcessEnv;
|
|
180
|
+
}): Record<string, string>;
|
|
181
|
+
export {};
|
|
33
182
|
//# sourceMappingURL=aidrive-upload.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aidrive-upload.d.ts","sourceRoot":"","sources":["../../src/commands/aidrive-upload.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"aidrive-upload.d.ts","sourceRoot":"","sources":["../../src/commands/aidrive-upload.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,UAAU,MAAM,MAAM,CAAA;AAKlC;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,SAAS,MAAM,EAAE,GAC1B,MAAM,GAAG,SAAS,CAIpB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,EAAE;IACjD,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAA;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,OAAO,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,GAAG;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAgF/D;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,SAAS,MAAM,EAAE,EAC3B,IAAI,EAAE;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,SAA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S,CA2BX;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE;IAC1C,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,GAAG;IAAE,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAY1C;AAGD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE;IACzC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,EAAE,MAAM,CAAA;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAA;CACxB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAMzB"}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import * as fs from 'fs';
|
|
2
|
+
import * as pathModule from 'path';
|
|
3
|
+
import { resolveRequestCredential } from '../config.js';
|
|
4
|
+
import { bareOperands, drivePathSpelling } from './aidrive-operands.js';
|
|
2
5
|
/**
|
|
3
6
|
* Pick the first operand that is an existing local file or directory.
|
|
4
7
|
*
|
|
@@ -10,6 +13,217 @@ import * as fs from 'fs';
|
|
|
10
13
|
export function pickExistingUploadOperand(operands) {
|
|
11
14
|
return operands.find((a) => typeof a === 'string' && fs.existsSync(a));
|
|
12
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* Name the operands of `gsk drive upload <local> [<drive destination>]`.
|
|
18
|
+
* The local source is `--local_file` or else the first operand that exists
|
|
19
|
+
* on disk (none with `--file_content`); the destination is `--path`/`-p` or
|
|
20
|
+
* the operand left over. Before this, a destination operand was dropped and
|
|
21
|
+
* the file landed at the drive root. Anything ambiguous is refused, with
|
|
22
|
+
* nothing sent: a second destination beside `--upload_path`, a stray
|
|
23
|
+
* operand, a destination operand that also exists on this disk (which of
|
|
24
|
+
* the two is the upload?), and a disk's root as the local source. A drive
|
|
25
|
+
* spelling (`/mnt/aidrive/…`, `aidrive://…`) is never read off this disk:
|
|
26
|
+
* in a sandbox the drive itself is mounted there.
|
|
27
|
+
*/
|
|
28
|
+
export function resolveAidriveUploadOperands(opts) {
|
|
29
|
+
// A local file named "true" is an upload, not a flag's leftover value.
|
|
30
|
+
const typed = opts.operands.filter(operand => operand.length > 0 &&
|
|
31
|
+
(bareOperands([operand]).length > 0 || fs.existsSync(operand)));
|
|
32
|
+
const sameAsLocalFile = (operand) => !!opts.localFile &&
|
|
33
|
+
pathModule.resolve(operand) === pathModule.resolve(opts.localFile);
|
|
34
|
+
// An operand that repeats --local_file is that file again when something
|
|
35
|
+
// else names the destination; alone, it stands where the destination
|
|
36
|
+
// goes and is read as one (`--local_file Reports/q3.pdf Reports/q3.pdf`).
|
|
37
|
+
const others = typed.filter(operand => !sameAsLocalFile(operand));
|
|
38
|
+
const named = !!(opts.path || opts.uploadPath) || others.length > 0;
|
|
39
|
+
const bare = named ? others : typed;
|
|
40
|
+
let localFile = opts.localFile;
|
|
41
|
+
let rest = bare;
|
|
42
|
+
if (!localFile && !opts.inline) {
|
|
43
|
+
localFile = pickExistingUploadOperand(bare);
|
|
44
|
+
if (localFile === undefined && bare.length > 0) {
|
|
45
|
+
const listed = bare.map(operand => `'${operand}'`).join(', ');
|
|
46
|
+
return {
|
|
47
|
+
error: `upload needs a local file or folder, and ${listed} ` +
|
|
48
|
+
`${bare.length > 1 ? 'do not exist' : 'does not exist'} on this disk. ` +
|
|
49
|
+
'Name it with --local_file <path>, or pass --file_content <text>. Nothing was sent.',
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
if (localFile !== undefined) {
|
|
53
|
+
const index = bare.indexOf(localFile);
|
|
54
|
+
rest = [...bare.slice(0, index), ...bare.slice(index + 1)];
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if (localFile !== undefined && isDiskRoot(localFile)) {
|
|
58
|
+
return {
|
|
59
|
+
error: 'upload of a disk root would read the whole disk; name the folder to ' +
|
|
60
|
+
'upload. Nothing was sent.',
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
// Checked before the count, so a second local file is named as such.
|
|
64
|
+
const onDisk = operandOnDisk(rest, {
|
|
65
|
+
adopted: !opts.localFile && !opts.inline,
|
|
66
|
+
localFile: opts.localFile,
|
|
67
|
+
});
|
|
68
|
+
if (onDisk !== undefined) {
|
|
69
|
+
return {
|
|
70
|
+
error: opts.inline
|
|
71
|
+
? `'${onDisk}' exists on this disk; with --file_content the operand is ` +
|
|
72
|
+
'the drive path. Name it with -p, or upload the local file with ' +
|
|
73
|
+
'--local_file. Nothing was sent.'
|
|
74
|
+
: `'${onDisk}' exists on this disk too, so it is unclear which is the ` +
|
|
75
|
+
'upload. Upload one local file or folder per call, and name the ' +
|
|
76
|
+
'drive destination with -p <drive path>. Nothing was sent.',
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
const destinations = [opts.path, ...rest].filter((destination) => !!destination);
|
|
80
|
+
if (opts.uploadPath && destinations.length > 0) {
|
|
81
|
+
return {
|
|
82
|
+
error: `--upload_path ${opts.uploadPath} and ${destinations[0]} both name ` +
|
|
83
|
+
'where the upload goes; pass one. Nothing was sent.',
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
if (destinations.length > 1) {
|
|
87
|
+
const extra = destinations
|
|
88
|
+
.slice(1)
|
|
89
|
+
.map(destination => `'${destination}'`)
|
|
90
|
+
.join(', ');
|
|
91
|
+
return {
|
|
92
|
+
error: 'upload takes one local file or folder and one drive destination; ' +
|
|
93
|
+
`${extra} ${destinations.length > 2 ? 'are' : 'is'} left over. ` +
|
|
94
|
+
'Quote a path that contains spaces. Nothing was sent.',
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
return { localFile, destination: destinations[0] };
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* The destination operand that also exists on this disk, which makes it
|
|
101
|
+
* unclear which of two is the upload. With the source adopted from the
|
|
102
|
+
* operands, any operand on disk (but `/`) could be the upload; beside
|
|
103
|
+
* --local_file or inline content, a file is suspect, and so is a folder
|
|
104
|
+
* spelled as a local path (`./site`), while a folder like /tmp may well
|
|
105
|
+
* name a drive folder. A drive spelling (`/mnt/aidrive/…`) is never read
|
|
106
|
+
* off this disk: in a sandbox the drive itself is mounted there.
|
|
107
|
+
*/
|
|
108
|
+
export function operandOnDisk(operands, opts, probe = { exists: fs.existsSync, isFile: isLocalFile }) {
|
|
109
|
+
return operands.find(operand => {
|
|
110
|
+
if (drivePathSpelling(operand) !== operand)
|
|
111
|
+
return false;
|
|
112
|
+
if (opts.localFile &&
|
|
113
|
+
pathModule.resolve(operand) === pathModule.resolve(opts.localFile)) {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
if (opts.adopted)
|
|
117
|
+
return operand !== '/' && probe.exists(operand);
|
|
118
|
+
return (probe.isFile(operand) ||
|
|
119
|
+
(/^\.\.?([\\/]|$)/.test(operand) && probe.exists(operand)));
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
/** Whether a local path is the root of its disk: `/`, or `C:\\` on Windows,
|
|
123
|
+
* where `resolve('/')` is the drive root and a `=== '/'` test never matched. */
|
|
124
|
+
export function isDiskRoot(candidate, paths = pathModule) {
|
|
125
|
+
const resolved = paths.resolve(candidate);
|
|
126
|
+
return paths.parse(resolved).root === resolved;
|
|
127
|
+
}
|
|
128
|
+
function isLocalFile(candidate) {
|
|
129
|
+
try {
|
|
130
|
+
return fs.statSync(candidate).isFile();
|
|
131
|
+
}
|
|
132
|
+
catch {
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* A drive path as the upload endpoint takes it: `aidrive:///a/b`, the
|
|
138
|
+
* sandbox mount `/mnt/aidrive/a/b` and `/aidrive/a/b` all mean `/a/b`, as
|
|
139
|
+
* the tool lane reads them; the file lane stored them as literal folders.
|
|
140
|
+
* A URL is refused: a Drive link names a folder through `--url`, not as a
|
|
141
|
+
* path. So is a Windows drive path, which names this disk.
|
|
142
|
+
*/
|
|
143
|
+
export function normalizeUploadDestination(destination) {
|
|
144
|
+
const spelled = drivePathSpelling(destination);
|
|
145
|
+
if (spelled !== destination)
|
|
146
|
+
return { path: spelled };
|
|
147
|
+
if (/^[a-z][a-z0-9+.-]*:\/\//i.test(destination)) {
|
|
148
|
+
return {
|
|
149
|
+
error: `'${destination}' is a URL, not a drive path; to upload into the ` +
|
|
150
|
+
'folder a Drive link names, pass it with --url. Nothing was sent.',
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
if (/^[a-z]:[\\/]/i.test(destination)) {
|
|
154
|
+
return {
|
|
155
|
+
error: `'${destination}' is a path on this disk, not a drive path; name the ` +
|
|
156
|
+
'drive folder like /Reports/. Nothing was sent.',
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
return { path: destination };
|
|
160
|
+
}
|
|
161
|
+
/** A name's extension for the rename rule. A dotfile's name is its own
|
|
162
|
+
* extension (`.env`): Node reads it as having none. */
|
|
163
|
+
function fileExtension(name) {
|
|
164
|
+
const extension = pathModule.posix.extname(name);
|
|
165
|
+
if (!extension && name.startsWith('.') && name.length > 1) {
|
|
166
|
+
return name.toLowerCase();
|
|
167
|
+
}
|
|
168
|
+
return extension.toLowerCase();
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Where an upload lands when its destination was an operand or `--path`:
|
|
172
|
+
* the folder that receives it (created if missing), unless the last name is
|
|
173
|
+
* the upload's own: the same name, or for a file one with the same
|
|
174
|
+
* extension, which renames it (`/Reports/q3-final.pdf`). A trailing `/`
|
|
175
|
+
* always means a folder. A last name with a different extension, or with
|
|
176
|
+
* one when the file has none, is refused: read as a folder it became
|
|
177
|
+
* `/Photos/beach.jpg/photo.jpeg`. The upload is named after its resolved
|
|
178
|
+
* local path, so `..` cannot collapse the destination.
|
|
179
|
+
*/
|
|
180
|
+
export function uploadPathForDestination(destination, localPath, isDirectory) {
|
|
181
|
+
const name = pathModule.basename(pathModule.resolve(localPath));
|
|
182
|
+
if (destination.endsWith('/'))
|
|
183
|
+
return { uploadPath: `${destination}${name}` };
|
|
184
|
+
const last = pathModule.posix.basename(destination);
|
|
185
|
+
if (last === name)
|
|
186
|
+
return { uploadPath: destination };
|
|
187
|
+
if (!isDirectory) {
|
|
188
|
+
const lastExtension = fileExtension(last);
|
|
189
|
+
const extension = fileExtension(name);
|
|
190
|
+
if (lastExtension && lastExtension === extension) {
|
|
191
|
+
return { uploadPath: destination };
|
|
192
|
+
}
|
|
193
|
+
if (lastExtension) {
|
|
194
|
+
return {
|
|
195
|
+
error: `'${destination}' names a file of another type than '${name}'. End it ` +
|
|
196
|
+
`with / to upload into that folder, or give the file's path with ` +
|
|
197
|
+
`--upload_path ${destination}. Nothing was sent.`,
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
return { uploadPath: `${destination}/${name}` };
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* What is wrong with an upload's same-name answer, or '' when nothing: an
|
|
205
|
+
* unknown `--on-conflict` (the server read one as rename, so a typo landed
|
|
206
|
+
* a `name(1)` copy), and `--on-conflict overwrite` beside `--overwrite
|
|
207
|
+
* false`. Inline content has no rename: a taken name is refused or replaced.
|
|
208
|
+
*/
|
|
209
|
+
export function uploadConflictProblem(conflict, args, inline) {
|
|
210
|
+
if (conflict.error)
|
|
211
|
+
return conflict.error;
|
|
212
|
+
const choice = conflict.onConflict;
|
|
213
|
+
if (choice && !['error', 'rename', 'overwrite'].includes(choice)) {
|
|
214
|
+
return `--on-conflict takes error, rename, or overwrite, not ${choice}`;
|
|
215
|
+
}
|
|
216
|
+
if (choice === 'overwrite' &&
|
|
217
|
+
(args.overwrite === false || args.overwrite === 'false')) {
|
|
218
|
+
return '--on-conflict overwrite contradicts --overwrite false; pass one';
|
|
219
|
+
}
|
|
220
|
+
if (inline && choice === 'rename') {
|
|
221
|
+
return ('--on-conflict rename applies to --local_file uploads; with ' +
|
|
222
|
+
'--file_content a taken name is refused, or replaced with ' +
|
|
223
|
+
'--on-conflict overwrite');
|
|
224
|
+
}
|
|
225
|
+
return '';
|
|
226
|
+
}
|
|
13
227
|
export function collectUploadFiles(root) {
|
|
14
228
|
const stat = fs.statSync(root);
|
|
15
229
|
if (stat.isFile()) {
|
|
@@ -60,4 +274,134 @@ export function buildAidriveUploadQuery(opts) {
|
|
|
60
274
|
query.set('url', opts.locator.url);
|
|
61
275
|
return query;
|
|
62
276
|
}
|
|
277
|
+
/** How a same-name collision is answered on the streaming lane, from the
|
|
278
|
+
* three spellings a caller may use: the tool schema's `--overwrite true`
|
|
279
|
+
* (the one every prompt teaches), the CLI's older `--override` flag, and
|
|
280
|
+
* `--on-conflict error|rename|overwrite`. Overwrite keeps the entry's id,
|
|
281
|
+
* so its share link stays valid — the point of editing a file in place.
|
|
282
|
+
* Two spellings that disagree are refused rather than silently ranked:
|
|
283
|
+
* a renamed copy under a new id is exactly the outcome the caller was
|
|
284
|
+
* trying to avoid. The lane never forwards tool args, so `--overwrite`
|
|
285
|
+
* has to be read here. */
|
|
286
|
+
/** The lane's conflict answer read off what Commander parsed: `opts` holds
|
|
287
|
+
* the CLI-only flags (`--override`, `--on-conflict`), `args` the tool
|
|
288
|
+
* schema's (`--overwrite`, which Commander parses to a boolean). */
|
|
289
|
+
export function uploadConflictFromCli(opts, args) {
|
|
290
|
+
return resolveUploadConflict({
|
|
291
|
+
override: !!opts.override,
|
|
292
|
+
overwrite: args.overwrite === true || args.overwrite === 'true',
|
|
293
|
+
onConflict: (opts.onConflict ??
|
|
294
|
+
opts['on-conflict'] ??
|
|
295
|
+
opts.on_conflict ??
|
|
296
|
+
args.on_conflict),
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
/** The share args an upload carries along (`--to`, `--general_access`, …),
|
|
300
|
+
* or an empty object when the caller asked for no share. */
|
|
301
|
+
export function shareArgsFromUpload(args) {
|
|
302
|
+
const share = {};
|
|
303
|
+
for (const key of [
|
|
304
|
+
'to',
|
|
305
|
+
'general_access',
|
|
306
|
+
'permission',
|
|
307
|
+
'expires_at',
|
|
308
|
+
'organization_id',
|
|
309
|
+
'post_card',
|
|
310
|
+
]) {
|
|
311
|
+
if (args[key] !== undefined)
|
|
312
|
+
share[key] = args[key];
|
|
313
|
+
}
|
|
314
|
+
return share.to || share.general_access ? share : {};
|
|
315
|
+
}
|
|
316
|
+
/** Why `--to` / `--general_access` cannot ride this upload, or '' when
|
|
317
|
+
* they can: the share verb the lane runs next is the My Drive one, so a
|
|
318
|
+
* shared destination (a workspace other than My Drive, a `--source`,
|
|
319
|
+
* which selects one whatever the workspace says, a folder id / URL,
|
|
320
|
+
* which may be anyone's, or a shared drive's web address) is refused up
|
|
321
|
+
* front — its sharing has its own verb and admin gate. A folder upload
|
|
322
|
+
* has no single file to share. */
|
|
323
|
+
export function uploadShareRefusal(opts) {
|
|
324
|
+
if (opts.isDirectory) {
|
|
325
|
+
return ('--to / --general_access share one file; upload the folder first, ' +
|
|
326
|
+
'then `gsk drive share --path <folder> …`');
|
|
327
|
+
}
|
|
328
|
+
if (opts.addressedById) {
|
|
329
|
+
// A folder id or URL may name a folder in someone else's drive; the
|
|
330
|
+
// share that follows would run as My Drive against it and miss.
|
|
331
|
+
return ('--to / --general_access share a My Drive path upload; with --id/--url, ' +
|
|
332
|
+
'upload first, then `gsk drive share --id <uploaded id> …`');
|
|
333
|
+
}
|
|
334
|
+
if (opts.uploadPath?.startsWith('/.shared-workspace/')) {
|
|
335
|
+
// The web app's address names a shared drive: the upload lands there,
|
|
336
|
+
// where only a Team Drive's managers share it on.
|
|
337
|
+
return ('--to / --general_access share a My Drive upload; this address is a ' +
|
|
338
|
+
'shared drive. Upload first; a Team Drive manager then shares it with ' +
|
|
339
|
+
`gsk drive share --path ${opts.uploadPath} …`);
|
|
340
|
+
}
|
|
341
|
+
if (opts.workspace !== 'my_drive' || opts.source) {
|
|
342
|
+
const workspace = opts.workspace === 'my_drive' ? 'shared_with_me' : opts.workspace;
|
|
343
|
+
return ('--to / --general_access share a My Drive upload; a shared source is ' +
|
|
344
|
+
`opened with: gsk drive share --workspace ${workspace} --source ` +
|
|
345
|
+
`${opts.source || '<source_id>'} --path <path> …`);
|
|
346
|
+
}
|
|
347
|
+
return '';
|
|
348
|
+
}
|
|
349
|
+
/** One reply for "uploaded, then shared": the share's human summary joins
|
|
350
|
+
* the upload message (replacing the upload's "share it like so" hint,
|
|
351
|
+
* which the share just did), and its structured answer rides in
|
|
352
|
+
* `data.share`. A share failure keeps the upload result — the file is
|
|
353
|
+
* there, so the reply stays `ok` (an `error` would send a retrying agent
|
|
354
|
+
* back through the upload, landing a second copy) and `data.share.status`
|
|
355
|
+
* plus the message say the sharing failed. A tool reply carries its
|
|
356
|
+
* summary in `data.result` and the structured answer in
|
|
357
|
+
* `session_state.aidrive_result`. */
|
|
358
|
+
export function mergeShareIntoUpload(upload, shared) {
|
|
359
|
+
const shareData = shared.data && typeof shared.data === 'object'
|
|
360
|
+
? shared.data
|
|
361
|
+
: {};
|
|
362
|
+
const shareState = shared.session_state;
|
|
363
|
+
const shareText = typeof shareData.result === 'string' ? shareData.result : shared.message;
|
|
364
|
+
const uploadText = shared.status === 'ok'
|
|
365
|
+
? upload.message.split(' — opens for the people')[0]
|
|
366
|
+
: upload.message;
|
|
367
|
+
const share = shared.status === 'ok'
|
|
368
|
+
? (shareState?.aidrive_result ?? shareData)
|
|
369
|
+
: { status: 'error', error: shareText, ...shareData };
|
|
370
|
+
return {
|
|
371
|
+
status: 'ok',
|
|
372
|
+
message: shared.status === 'ok'
|
|
373
|
+
? `${uploadText}\n${shareText}`
|
|
374
|
+
: `${uploadText}\nUploaded, but sharing failed: ${shareText}`,
|
|
375
|
+
data: { ...upload.data, share },
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
export function resolveUploadConflict(opts) {
|
|
379
|
+
const explicit = (opts.onConflict ?? '').trim().toLowerCase();
|
|
380
|
+
const wantsOverwrite = Boolean(opts.override || opts.overwrite);
|
|
381
|
+
if (explicit && explicit !== 'overwrite' && wantsOverwrite) {
|
|
382
|
+
return {
|
|
383
|
+
error: `--on-conflict ${explicit} contradicts --overwrite; ` +
|
|
384
|
+
'pass one or the other',
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
if (explicit)
|
|
388
|
+
return { onConflict: explicit };
|
|
389
|
+
return wantsOverwrite ? { onConflict: 'overwrite' } : {};
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Headers for the raw streaming AI Drive upload. This lane bypasses
|
|
393
|
+
* ApiClient (it streams the file body itself), so it must pick the request
|
|
394
|
+
* credential the same way: the per-turn `GSK_TURN_TOKEN` when present, else
|
|
395
|
+
* the api key — `aidrive` is owner-gated, and without the turn credential a
|
|
396
|
+
* parallel-turn sandbox would be denied as unattributable.
|
|
397
|
+
*/
|
|
398
|
+
export function aidriveUploadHeaders(opts) {
|
|
399
|
+
const headers = { 'Content-Type': opts.contentType };
|
|
400
|
+
const credential = resolveRequestCredential(opts.apiKey, opts.env ?? process.env);
|
|
401
|
+
if (credential)
|
|
402
|
+
headers['X-Api-Key'] = credential;
|
|
403
|
+
if (opts.projectId)
|
|
404
|
+
headers['X-Project-ID'] = opts.projectId;
|
|
405
|
+
return headers;
|
|
406
|
+
}
|
|
63
407
|
//# sourceMappingURL=aidrive-upload.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aidrive-upload.js","sourceRoot":"","sources":["../../src/commands/aidrive-upload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,IAAI,CAAA;AAExB;;;;;;;GAOG;AACH,MAAM,UAAU,yBAAyB,CACvC,QAA2B;IAE3B,OAAO,QAAQ,CAAC,IAAI,CAClB,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,CACjD,CA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,CAAA;IAC7D,MAAM,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,SAAS,CAAC,CAAA;IAC/D,IAAI,QAAQ,IAAI,QAAQ,KAAK,WAAW,IAAI,cAAc,EAAE,CAAC;QAC3D,OAAO;YACL,KAAK,EACH,iBAAiB,QAAQ,4BAA4B;gBACrD,uBAAuB;SAC1B,CAAA;IACH,CAAC;IACD,IAAI,QAAQ;QAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAA;IAC7C,OAAO,cAAc,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAA;AAC1D,CAAC;AAGD;;;;;;GAMG;AACH,MAAM,UAAU,oBAAoB,CAAC,IAKpC;IACC,MAAM,OAAO,GAA2B,EAAE,cAAc,EAAE,IAAI,CAAC,WAAW,EAAE,CAAA;IAC5E,MAAM,UAAU,GAAG,wBAAwB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,CAAA;IACjF,IAAI,UAAU;QAAE,OAAO,CAAC,WAAW,CAAC,GAAG,UAAU,CAAA;IACjD,IAAI,IAAI,CAAC,SAAS;QAAE,OAAO,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC,SAAS,CAAA;IAC5D,OAAO,OAAO,CAAA;AAChB,CAAC"}
|
|
@@ -33,5 +33,14 @@
|
|
|
33
33
|
* stdout/stderr cap, 5 req/sec rate limit on /exec.
|
|
34
34
|
*/
|
|
35
35
|
import { Command } from 'commander';
|
|
36
|
+
interface DesignOpts {
|
|
37
|
+
prompt?: string;
|
|
38
|
+
launchUrl?: string;
|
|
39
|
+
allowBuildTools?: boolean;
|
|
40
|
+
open?: boolean;
|
|
41
|
+
}
|
|
42
|
+
/** Only an explicit `--no-open` skips the browser; unset `open` means open. */
|
|
43
|
+
export declare function shouldOpenBrowser(opts: DesignOpts): boolean;
|
|
36
44
|
export declare function registerDesignCommand(program: Command): void;
|
|
45
|
+
export {};
|
|
37
46
|
//# sourceMappingURL=design.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"design.d.ts","sourceRoot":"","sources":["../../src/commands/design.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"design.d.ts","sourceRoot":"","sources":["../../src/commands/design.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAu/BnC,UAAU,UAAU;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,eAAe,CAAC,EAAE,OAAO,CAAA;IAEzB,IAAI,CAAC,EAAE,OAAO,CAAA;CACf;AAED,+EAA+E;AAC/E,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAE3D;AAkED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAmC5D"}
|
package/dist/commands/design.js
CHANGED
|
@@ -920,6 +920,10 @@ function openInBrowser(url) {
|
|
|
920
920
|
info(`(Could not open browser automatically: ${e.message})`);
|
|
921
921
|
}
|
|
922
922
|
}
|
|
923
|
+
/** Only an explicit `--no-open` skips the browser; unset `open` means open. */
|
|
924
|
+
export function shouldOpenBrowser(opts) {
|
|
925
|
+
return opts.open !== false;
|
|
926
|
+
}
|
|
923
927
|
async function runDesignCommand(pathArg, opts) {
|
|
924
928
|
const cwd = path.resolve(pathArg || process.cwd());
|
|
925
929
|
if (!fs.existsSync(cwd) || !fs.statSync(cwd).isDirectory()) {
|
|
@@ -947,14 +951,20 @@ async function runDesignCommand(pathArg, opts) {
|
|
|
947
951
|
const baseLaunch = opts.launchUrl || DEFAULT_LAUNCH_URL;
|
|
948
952
|
const sep = baseLaunch.includes('#') ? '&' : '#';
|
|
949
953
|
const launchUrl = `${baseLaunch}${sep}ccbridge_nonce=${state.nonce}`;
|
|
954
|
+
const shouldOpen = shouldOpenBrowser(opts);
|
|
950
955
|
info(`🔒 Bridge ready: data=127.0.0.1:${state.port} exchange=127.0.0.1:${EXCHANGE_PORT}`);
|
|
951
956
|
info(`👉 Open: ${launchUrl}`);
|
|
952
|
-
|
|
957
|
+
if (shouldOpen) {
|
|
958
|
+
info(` (Browser opening automatically — close the tab to exit early.)`);
|
|
959
|
+
}
|
|
960
|
+
else {
|
|
961
|
+
info(` (Browser opening disabled; open the URL above manually — the link is single-use.)`);
|
|
962
|
+
}
|
|
953
963
|
info(` cwd: ${cwd}`);
|
|
954
964
|
if (opts.allowBuildTools) {
|
|
955
965
|
info(` ⚠️ --allow-build-tools enabled: git / npm / python / etc allowed`);
|
|
956
966
|
}
|
|
957
|
-
if (
|
|
967
|
+
if (shouldOpen) {
|
|
958
968
|
openInBrowser(launchUrl);
|
|
959
969
|
}
|
|
960
970
|
// Block until /back_to_cc fires (or Ctrl-C).
|