@notis_ai/cli 0.2.30 → 0.2.31
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 +1 -0
- package/dist/agent-hooks/notis-agent-hook.mjs +37890 -10794
- package/dist/base-skills/notis-cli/.notis-base-skill.json +1 -1
- package/dist/base-skills/notis-cli/references/native-databases.md +1 -1
- package/dist/base-skills/notis-query/.notis-base-skill.json +1 -1
- package/dist/base-skills/notis-query/references/query.md +6 -4
- package/dist/base-skills/notis-spaces/.notis-base-skill.json +1 -1
- package/dist/base-skills/notis-spaces/SKILL.md +8 -3
- package/dist/base-skills/notis-spaces/references/architecture.md +4 -1
- package/dist/base-skills/notis-spaces/references/design.md +7 -1
- package/dist/base-skills/notis-spaces/references/fixtures.md +27 -2
- package/dist/base-skills/notis-spaces/references/sdk.md +90 -31
- package/dist/base-skills/notis-spaces/references/troubleshooting.md +3 -0
- package/dist/base-skills/notis-spaces/references/views.md +20 -0
- package/dist/sdk/src/hooks/useNativeDocuments.ts +50 -12
- package/dist/sdk/src/index.ts +1 -1
- package/dist/sdk/src/space.ts +3 -1
- package/dist/sdk/src/tailwind.ts +53 -3
- package/dist/sdk/src/ui/icons.tsx +1 -0
- package/dist/sdk/src/words/types.ts +28 -0
- package/dist/skill-sync/index.js +10 -90
- package/dist/skill-sync-worker.mjs +50 -93
- package/dist/space-harness/host.js +150 -81
- package/dist/space-sdk/dist/chunk-3DFOGU26.js +3 -0
- package/dist/space-sdk/dist/index.js +2 -2
- package/dist/space-sdk/dist/ui.js +12 -12
- package/dist/space-sdk/src/hooks/useNativeDocuments.d.ts +23 -0
- package/dist/space-sdk/src/index.d.ts +1 -1
- package/dist/space-sdk/src/space.ts +3 -1
- package/dist/space-sdk/src/tailwind-candidates.d.ts +273 -2
- package/dist/space-sdk/src/tailwind.ts +53 -3
- package/dist/space-sdk/src/ui/blocks/DataTable.d.ts +19 -4
- package/dist/space-sdk/src/ui/blocks/Meter.d.ts +12 -3
- package/dist/space-sdk/src/ui/blocks/Tabs.d.ts +7 -1
- package/dist/space-sdk/src/ui/blocks/index.d.ts +1 -1
- package/dist/space-sdk/src/ui/charts/CalendarHeatmap.d.ts +69 -0
- package/dist/space-sdk/src/ui/charts/Chart.d.ts +18 -3
- package/dist/space-sdk/src/ui/charts/chartData.d.ts +19 -0
- package/dist/space-sdk/src/ui/charts/heatmapData.d.ts +81 -0
- package/dist/space-sdk/src/ui/index.d.ts +4 -2
- package/dist/space-sdk/src/ui/list/Row.d.ts +11 -1
- package/dist/space-sdk/src/ui/period/dateFormat.d.ts +2 -0
- package/dist/space-sdk/src/ui/period/dateWords.d.ts +9 -0
- package/dist/space-sdk/src/ui/period/periods.d.ts +15 -2
- package/dist/space-sdk/src/words/types.ts +28 -0
- package/dist/view-renderer/dist/host.js +219 -150
- package/dist/view-renderer/src/dom.js +3 -2
- package/dist/view-renderer/src/errors.js +9 -0
- package/dist/view-renderer/src/host.tsx +12 -5
- package/dist/view-renderer/src/remote-broker.js +3 -1
- package/dist/view-renderer/src/renderer.js +63 -16
- package/dist/view-renderer/src/skeleton.js +70 -18
- package/package.json +5 -4
- package/skills/notis-query/cli.md +3 -0
- package/src/command-specs/spaces.js +71 -15
- package/src/command-specs/tools.js +3 -0
- package/src/runtime/api-hosts.generated.js +35 -0
- package/src/runtime/api-hosts.js +27 -10
- package/src/runtime/app-platform.js +68 -24
- package/src/runtime/http-agent.js +53 -0
- package/src/runtime/native-record-files.js +11 -0
- package/src/runtime/oauth.js +2 -1
- package/src/runtime/skill-sync/cloud-client.ts +0 -10
- package/src/runtime/skill-sync/index.ts +13 -15
- package/src/runtime/skill-sync/local-scanner.ts +0 -67
- package/src/runtime/skill-sync/types.ts +1 -0
- package/src/runtime/skill-sync/write-cloud-skill.ts +7 -23
- package/src/runtime/space-dependencies.js +66 -0
- package/src/runtime/space-fixture-broker.js +23 -8
- package/src/runtime/space-platform.js +47 -3
- package/src/runtime/space-source.js +10 -1
- package/src/runtime/space-test-server.js +105 -6
- package/src/runtime/space-verification.js +103 -43
- package/src/runtime/space-view-manifest.js +38 -5
- package/src/runtime/transport.js +19 -4
- package/src/runtime/view-render.js +4 -1
- package/template/tailwind.config.ts +2 -35
- package/dist/space-sdk/dist/chunk-6GJ2BS7B.js +0 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { scaffoldSpaceCollection } from '../runtime/space-collection-scaffold.js';
|
|
2
2
|
import { appFilesDigest, clearSpaceScreenshots, loadAppConfig, pullAppSource, resolveProjectDir, saveSpacePendingScreenshots, saveSpaceScreenshots, saveSpaceVerification, spacePublicationIntent, syncSpaceSdk } from '../runtime/app-platform.js';
|
|
3
|
-
import { buildSpaceArtifact, prepareSpaceRelease, requireSpaceIcon } from '../runtime/space-platform.js';
|
|
3
|
+
import { buildSpaceArtifact, compileSpaceSqlReads, prepareSpaceRelease, requireSpaceIcon } from '../runtime/space-platform.js';
|
|
4
4
|
import { verifySpaceRelease } from '../runtime/space-verification.js';
|
|
5
5
|
import { loadSelectedSpace } from '../runtime/space-source.js';
|
|
6
6
|
import { refreshSpaceAuthoring } from '../runtime/space-database-structures.js';
|
|
@@ -145,11 +145,15 @@ function describePendingChanges(summary) {
|
|
|
145
145
|
|
|
146
146
|
const SKELETON_FILE = 'bundle/skeleton.json';
|
|
147
147
|
|
|
148
|
-
/**
|
|
148
|
+
/**
|
|
149
|
+
* Reviewable: where the screenshots of the loaded view are (each width in English and French, per fixture context),
|
|
150
|
+
* and each one that had not finished loading its data.
|
|
151
|
+
*/
|
|
149
152
|
function describeScreenshots(render) {
|
|
150
153
|
const renders = render?.renders || [];
|
|
151
154
|
const paths = renders.filter(value => value.loaded && value.screenshot_path).map(value => value.screenshot_path);
|
|
152
|
-
const parts =
|
|
155
|
+
const parts = render?.contexts?.length ? [`Fixture contexts checked: ${render.contexts.join(', ')}.`] : [];
|
|
156
|
+
if (paths.length) parts.push(`Screenshots after the data loaded: ${paths.join(', ')}.`);
|
|
153
157
|
for (const value of renders.filter(item => item.loaded === false)) {
|
|
154
158
|
const message = value.message;
|
|
155
159
|
if (message) parts.push(value.screenshot_path ? `${message.replace(/\.$/, '')}; ${value.screenshot_path} shows what it showed then.` : message);
|
|
@@ -162,11 +166,10 @@ function describeSkeleton(skeleton) {
|
|
|
162
166
|
if (!skeleton) return '';
|
|
163
167
|
const parts = [skeleton.status === 'captured' ? `Loading skeleton measured for ${skeleton.regions.join(', ')}${skeleton.audience === 'public' ? ', as the public sees the view' : ''}.`
|
|
164
168
|
: skeleton.status === 'failed' ? 'The loading skeleton could not be measured; the view keeps its fallback skeleton.' : ''];
|
|
165
|
-
const
|
|
166
|
-
if (
|
|
167
|
-
const
|
|
168
|
-
|
|
169
|
-
parts.push(`Loading state warnings (${findings.length}): ${shown.join(' ')}${findings.length > 5 ? ` And ${findings.length - 5} more in the diagnostic.` : ''}`);
|
|
169
|
+
const groups = groupFindings(skeleton.findings || []);
|
|
170
|
+
if (groups.length) {
|
|
171
|
+
const shown = groups.slice(0, 5).map(value => `${value.where ? `[${value.where}] ` : ''}${value.message}`);
|
|
172
|
+
parts.push(`Loading state warnings (${groups.length}): ${shown.join(' ')}${groups.length > 5 ? ` And ${groups.length - 5} more in the diagnostic.` : ''}`);
|
|
170
173
|
}
|
|
171
174
|
const paths = (skeleton.pending_screenshots || []).map(value => value.path).filter(Boolean);
|
|
172
175
|
if (paths.length) parts.push(`Loading screenshots: ${paths.join(', ')}.`);
|
|
@@ -174,6 +177,25 @@ function describeSkeleton(skeleton) {
|
|
|
174
177
|
return text ? ` ${text}` : '';
|
|
175
178
|
}
|
|
176
179
|
|
|
180
|
+
/**
|
|
181
|
+
* One line per identical finding across widths and locales: `{ where: '390 and 1440, EN and FR, reader', message }`.
|
|
182
|
+
* The reader's loading state and each fixture context stay apart.
|
|
183
|
+
*/
|
|
184
|
+
function groupFindings(findings) {
|
|
185
|
+
const groups = new Map();
|
|
186
|
+
for (const value of findings) {
|
|
187
|
+
const id = JSON.stringify([value.check, value.message, value.region ?? null, value.state ?? null, value.context ?? null]);
|
|
188
|
+
const group = groups.get(id) || { widths: new Set(), locales: new Set(), state: value.state, context: value.context, message: value.message };
|
|
189
|
+
if (value.width) group.widths.add(value.width);
|
|
190
|
+
if (value.locale) group.locales.add(value.locale);
|
|
191
|
+
groups.set(id, group);
|
|
192
|
+
}
|
|
193
|
+
const and = values => values.join(' and ');
|
|
194
|
+
return [...groups.values()].map(group => ({ message: group.message, where: [and([...group.widths].sort((a, b) => a - b)),
|
|
195
|
+
and([...group.locales].sort().map(value => value.toUpperCase())), group.context ? `context ${group.context}` : '', group.state || '']
|
|
196
|
+
.filter(Boolean).join(', ') }));
|
|
197
|
+
}
|
|
198
|
+
|
|
177
199
|
/** Same server verification for this Space, source, grants and authorization mode. */
|
|
178
200
|
function sameVerification(verification, body, sourceDigest) {
|
|
179
201
|
return verification?.valid === true && verification.space_id === body.space_id && verification.source_digest === sourceDigest
|
|
@@ -181,6 +203,28 @@ function sameVerification(verification, body, sourceDigest) {
|
|
|
181
203
|
&& (verification.authorization_mode ?? 'authorize_missing') === (body.authorization_mode ?? 'authorize_missing');
|
|
182
204
|
}
|
|
183
205
|
|
|
206
|
+
// What each server step of a verify or deploy is doing, said before it starts so a long wait never looks like a hang.
|
|
207
|
+
const RELEASE_STEPS = { 'sql-reads': 'Compiling the SQL reads', 'source-verify': 'Checking the source and its authorizations',
|
|
208
|
+
'source-publish': 'Publishing', 'source-stage': 'Preparing the candidate revision' };
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* A verify or deploy whose server step got no answer says how to continue: a deploy resumes under the same
|
|
212
|
+
* request ID (the server finishes or confirms that release, never a second one); a verify published nothing.
|
|
213
|
+
*/
|
|
214
|
+
function resumableReleaseError(error, ctx, intentKey) {
|
|
215
|
+
if (!(error instanceof CliError) || !['network_error', 'network_timeout'].includes(error.code)) return error;
|
|
216
|
+
// The same command: its folder, --space, --space-id and --profile decide which release the request ID resumes.
|
|
217
|
+
const command = `notis ${ctx.spec.command_path.join(' ')}`;
|
|
218
|
+
const next = intentKey
|
|
219
|
+
? `Nothing is lost: run the same ${command} command again (same folder and options) with --request-id ${intentKey}; `
|
|
220
|
+
+ 'it resumes this release and never publishes it twice.'
|
|
221
|
+
: `Nothing was published: run the same ${command} command again.`;
|
|
222
|
+
return new CliError({ code: error.code, message: `${error.message} ${next}`, exitCode: error.exitCode, retryable: true,
|
|
223
|
+
details: { ...error.details, ...(intentKey ? { request_id_to_reuse: intentKey } : {}) },
|
|
224
|
+
hints: [intentKey ? { command: `--request-id ${intentKey}`, reason: `Add to the same ${command} command to resume this release` }
|
|
225
|
+
: { command, reason: 'Run the same command again' }, ...(error.hints || [])], cause: error.cause });
|
|
226
|
+
}
|
|
227
|
+
|
|
184
228
|
async function sourceRelease(ctx, publish, stageOnly = false) {
|
|
185
229
|
const { directory, key } = await selected(ctx);
|
|
186
230
|
const spaceId = destinationSpaceId(ctx, directory);
|
|
@@ -191,6 +235,14 @@ async function sourceRelease(ctx, publish, stageOnly = false) {
|
|
|
191
235
|
const release = await prepareSpaceRelease(directory, key);
|
|
192
236
|
try {
|
|
193
237
|
if (publish) requireSpaceIcon(release.manifest, key);
|
|
238
|
+
const call = async (operation, data) => {
|
|
239
|
+
ctx.output.emitProgress?.({ phase: operation, message: `${RELEASE_STEPS[operation] || operation} on the server` });
|
|
240
|
+
try {
|
|
241
|
+
return await httpRequest({ runtime: { ...ctx.runtime, timeoutMs: Math.max(ctx.runtime.timeoutMs || 0, 600_000) },
|
|
242
|
+
method: 'POST', path: `/portal_spaces/${operation}`, body: data, spacesProtocol: true });
|
|
243
|
+
} catch (error) { throw resumableReleaseError(error, ctx, publish && !ctx.options.dryRun ? intentKey : null); }
|
|
244
|
+
};
|
|
245
|
+
const compiledReads = await compileSpaceSqlReads(release, call);
|
|
194
246
|
const identity = [ctx.runtime.apiBase.replace(/\/$/, ''), ctx.runtime.profileName, key, spaceId, intentKey];
|
|
195
247
|
let verification = publish && !ctx.options.dryRun ? spacePublicationIntent(directory, identity) : null;
|
|
196
248
|
const local = intentChanges(directory, spaceId, release.manifest,
|
|
@@ -200,8 +252,6 @@ async function sourceRelease(ctx, publish, stageOnly = false) {
|
|
|
200
252
|
...(ctx.options.reuseGrantsOnly ? { authorization_mode: 'reuse_only' } : {}),
|
|
201
253
|
...(local.changes ? { changes: local.changes } : {}) };
|
|
202
254
|
const sourceDigest = appFilesDigest(release.sourceFiles), builtDigest = appFilesDigest(release.files);
|
|
203
|
-
const call = (operation, data) => httpRequest({ runtime: { ...ctx.runtime, timeoutMs: Math.max(ctx.runtime.timeoutMs || 0, 600_000) },
|
|
204
|
-
method: 'POST', path: `/portal_spaces/${operation}`, body: data, spacesProtocol: true });
|
|
205
255
|
if (verification && (verification.local_changes_fingerprint ?? null) !== local.fingerprint) {
|
|
206
256
|
throw usageError('This request ID belongs to different Skill folders or list entries. Restore the state you first deployed to retry, or use a new request ID for a new release.');
|
|
207
257
|
}
|
|
@@ -220,6 +270,7 @@ async function sourceRelease(ctx, publish, stageOnly = false) {
|
|
|
220
270
|
const cancel = () => controller.abort();
|
|
221
271
|
process.once('SIGINT', cancel); process.once('SIGTERM', cancel);
|
|
222
272
|
let render;
|
|
273
|
+
ctx.output.emitProgress?.({ phase: 'render', message: 'Rendering the fixtures in a local browser' });
|
|
223
274
|
try { render = await verifySpaceRelease(release, { capabilities: verification.capabilities, signal: controller.signal,
|
|
224
275
|
authorizationMode: body.authorization_mode, unavailableActions: verification.unavailable_actions,
|
|
225
276
|
// Test seam only: the command context never carries it from user options.
|
|
@@ -227,7 +278,7 @@ async function sourceRelease(ctx, publish, stageOnly = false) {
|
|
|
227
278
|
finally { process.removeListener('SIGINT', cancel); process.removeListener('SIGTERM', cancel); }
|
|
228
279
|
const saved = saveSpaceScreenshots(directory, key, render.screenshots || []);
|
|
229
280
|
if (render.renders) render.renders = render.renders.map(value => {
|
|
230
|
-
const path = saved.find(item => item.width === value.width)?.path;
|
|
281
|
+
const path = saved.find(item => item.width === value.width && item.locale === value.locale && item.context === value.context)?.path;
|
|
231
282
|
return path ? { ...value, screenshot_path: path } : value;
|
|
232
283
|
});
|
|
233
284
|
if (render.skeleton) {
|
|
@@ -279,8 +330,9 @@ async function sourceRelease(ctx, publish, stageOnly = false) {
|
|
|
279
330
|
? (await call(stageOnly ? 'source-stage' : 'source-publish', { ...body, verification: serverVerification, request_id: intentKey })).payload
|
|
280
331
|
: serverVerification;
|
|
281
332
|
if (publish && !ctx.options.dryRun && !stageOnly) recordPublication(directory, local, result);
|
|
282
|
-
const data = { ...result, render, diagnostic_path: diagnosticPath, ...(local.summary ? { local_changes: local.summary } : {})
|
|
283
|
-
|
|
333
|
+
const data = { ...result, render, diagnostic_path: diagnosticPath, ...(local.summary ? { local_changes: local.summary } : {}),
|
|
334
|
+
...(compiledReads.length ? { compiled_sql_reads: compiledReads } : {}) };
|
|
335
|
+
const skeletonSummary = describeSkeleton(render.skeleton) + (compiledReads.length ? ` Compiled the SQL read${compiledReads.length > 1 ? 's' : ''} ${compiledReads.join(', ')}.` : ''), screenshotSummary = describeScreenshots(render);
|
|
284
336
|
return ctx.output.emitSuccess({ command: ctx.spec.command_path.join(' '), data,
|
|
285
337
|
humanSummary: publish && !ctx.options.dryRun
|
|
286
338
|
? stageOnly ? `Prepared ${key} as revision ${result.candidate_revision}. ${result.preview_url || 'This container has no executable preview.'} Live source was not changed.${describePendingChanges(local.summary).replace(/\.$/, '; they go live with notis spaces promote.')}${screenshotSummary}`
|
|
@@ -926,8 +978,12 @@ export const spacesCommandSpecs = [
|
|
|
926
978
|
backend_call: { type: 'local', name: 'space_build' },
|
|
927
979
|
async handler(ctx) {
|
|
928
980
|
const { directory, key } = await selected(ctx);
|
|
929
|
-
|
|
930
|
-
|
|
981
|
+
// A folder with no packages yet (a copy, a fresh clone) installs them once here, never asking for a separate npm ci.
|
|
982
|
+
const result = await buildSpaceArtifact(directory, key, { stdio: ctx.output.isMachineMode() ? 'pipe' : 'inherit', installDependencies: true,
|
|
983
|
+
installLog: message => ctx.output.emitProgress?.({ phase: 'install', message }) });
|
|
984
|
+
const installed = result.installed_dependencies;
|
|
985
|
+
return ctx.output.emitSuccess({ command: 'spaces build', data: result,
|
|
986
|
+
humanSummary: `${installed ? `Installed this Space's packages (${installed.command}, ${installed.seconds} s). ` : ''}Built ${key}; no Space was published.` });
|
|
931
987
|
},
|
|
932
988
|
},
|
|
933
989
|
{
|
|
@@ -2,6 +2,7 @@ import { accessSync, constants as fsConstants, createReadStream, existsSync, rea
|
|
|
2
2
|
import { createHash } from 'node:crypto';
|
|
3
3
|
import { basename } from 'node:path';
|
|
4
4
|
import { usageError } from '../runtime/errors.js';
|
|
5
|
+
import { ENV_FILE_MESSAGE, isEnvFileName } from '../runtime/native-record-files.js';
|
|
5
6
|
import {
|
|
6
7
|
canPrompt,
|
|
7
8
|
createStderrPrompter,
|
|
@@ -296,6 +297,7 @@ async function parseFileBindingSpec(spec, index) {
|
|
|
296
297
|
if (!localPath) {
|
|
297
298
|
throw usageError('--file local path is required');
|
|
298
299
|
}
|
|
300
|
+
if (isEnvFileName(localPath)) throw usageError(ENV_FILE_MESSAGE);
|
|
299
301
|
if (!existsSync(localPath)) {
|
|
300
302
|
throw usageError(`File not found: ${localPath}`);
|
|
301
303
|
}
|
|
@@ -762,6 +764,7 @@ export const toolsCommandSpecs = [
|
|
|
762
764
|
},
|
|
763
765
|
examples: [
|
|
764
766
|
'notis tools exec LOCAL_NOTIS_DATABASE_QUERY --arguments \'{"database_slug":"tasks","query":{}}\'',
|
|
767
|
+
'notis tools exec LOCAL_NOTIS_DATABASE_QUERY --arguments \'{"protocol":1,"target":{"database_id":"<database id>"},"input":{"mode":"rows"}}\'',
|
|
765
768
|
'notis tools exec LOCAL_NOTIS_DATABASE_GET_DATABASE --arguments \'{"database_slug":"tasks"}\'',
|
|
766
769
|
'notis tools exec LOCAL_NOTIS_DATABASE_QUERY --get-schema',
|
|
767
770
|
'notis tools exec LOCAL_NOTIS_DATABASE_QUERY --dry-run --arguments \'{"database_slug":"tasks","query":{}}\'',
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// GENERATED by scripts/generate_channel_hosts.py from server/lib/release_channels.py
|
|
2
|
+
// (CHANNEL_ORIGINS and _LEGACY_HOSTNAMES). Do not edit: change the server list, then run
|
|
3
|
+
// python3 scripts/generate_channel_hosts.py
|
|
4
|
+
|
|
5
|
+
/** Each channel's public origin per surface. */
|
|
6
|
+
export const CHANNEL_ORIGINS = {
|
|
7
|
+
stable: {
|
|
8
|
+
portal: 'https://app.notis.ai',
|
|
9
|
+
api: 'https://api.notis.ai',
|
|
10
|
+
mcp: 'https://mcp.notis.ai',
|
|
11
|
+
realtime: 'wss://realtime.notis.ai',
|
|
12
|
+
},
|
|
13
|
+
nightly: {
|
|
14
|
+
portal: 'https://app-nightly.notis.ai',
|
|
15
|
+
api: 'https://api-nightly.notis.ai',
|
|
16
|
+
mcp: 'https://mcp-nightly.notis.ai',
|
|
17
|
+
realtime: 'wss://realtime-nightly.notis.ai',
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/** Each channel's hostnames per surface, the current name first, then the retired ones. */
|
|
22
|
+
export const CHANNEL_HOSTNAMES = {
|
|
23
|
+
stable: {
|
|
24
|
+
portal: ['app.notis.ai'],
|
|
25
|
+
api: ['api.notis.ai'],
|
|
26
|
+
mcp: ['mcp.notis.ai'],
|
|
27
|
+
realtime: ['realtime.notis.ai', 'websocket-prod.onrender.com'],
|
|
28
|
+
},
|
|
29
|
+
nightly: {
|
|
30
|
+
portal: ['app-nightly.notis.ai'],
|
|
31
|
+
api: ['api-nightly.notis.ai'],
|
|
32
|
+
mcp: ['mcp-nightly.notis.ai'],
|
|
33
|
+
realtime: ['realtime-nightly.notis.ai', 'notis-websocket.onrender.com'],
|
|
34
|
+
},
|
|
35
|
+
};
|
package/src/runtime/api-hosts.js
CHANGED
|
@@ -1,18 +1,35 @@
|
|
|
1
|
+
import { CHANNEL_HOSTNAMES, CHANNEL_ORIGINS } from './api-hosts.generated.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Retired API names the CLI keeps knowing after the server list drops them. A
|
|
5
|
+
* retired name stays listed after its domain is removed: profiles that stored
|
|
6
|
+
* it keep being recognised and renamed to the channel's current API (CLI-037),
|
|
7
|
+
* and sign-ins recorded on it are known to be spent (CLI-038, CLI-039).
|
|
8
|
+
*/
|
|
9
|
+
const CLI_RETIRED_API_HOSTS = {
|
|
10
|
+
nightly: ['api-beta.notis.ai'],
|
|
11
|
+
};
|
|
12
|
+
|
|
1
13
|
/**
|
|
2
14
|
* The live Notis APIs, one row per release channel: the API's current name,
|
|
3
15
|
* the names it answered on before (retired), and the channel's Portal.
|
|
4
16
|
*
|
|
5
|
-
* Every CLI list of live API hosts derives from this table.
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* Mirrors server/lib/release_channels.py (CHANNEL_ORIGINS, _LEGACY_HOSTNAMES).
|
|
17
|
+
* Every CLI list of live API hosts derives from this table. The current and
|
|
18
|
+
* retired names come from api-hosts.generated.js, written by
|
|
19
|
+
* scripts/generate_channel_hosts.py from server/lib/release_channels.py
|
|
20
|
+
* (CHANNEL_ORIGINS, _LEGACY_HOSTNAMES): edit the server list and regenerate.
|
|
21
|
+
* CLI_RETIRED_API_HOSTS adds the retired names only the CLI still needs.
|
|
11
22
|
*/
|
|
12
|
-
const CHANNEL_APIS =
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
23
|
+
const CHANNEL_APIS = channelApis(CHANNEL_HOSTNAMES, CHANNEL_ORIGINS);
|
|
24
|
+
|
|
25
|
+
/** The CHANNEL_APIS rows of a generated host table, with the CLI's own retired names added. */
|
|
26
|
+
export function channelApis(channelHostnames, channelOrigins) {
|
|
27
|
+
return Object.fromEntries(Object.entries(channelHostnames).map(([channel, surfaces]) => {
|
|
28
|
+
const [current, ...legacy] = surfaces.api;
|
|
29
|
+
const retired = [...new Set([...legacy, ...(CLI_RETIRED_API_HOSTS[channel] || [])])].filter(host => host !== current);
|
|
30
|
+
return [channel, { current, retired, portal: channelOrigins[channel].portal }];
|
|
31
|
+
}));
|
|
32
|
+
}
|
|
16
33
|
|
|
17
34
|
const HOST_ROWS = Object.entries(CHANNEL_APIS).flatMap(([channel, row]) => [
|
|
18
35
|
{ host: row.current, channel, current: true },
|
|
@@ -2039,15 +2039,45 @@ function replaceVerifyImage(name, png) {
|
|
|
2039
2039
|
if (png) writeFileSync(name, png, { flag: 'wx', mode: 0o600 });
|
|
2040
2040
|
}
|
|
2041
2041
|
|
|
2042
|
-
const VERIFY_WIDTHS = [390, 1440], VERIFY_LOCALES = ['en', 'fr'];
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2042
|
+
export const VERIFY_WIDTHS = [390, 1440], VERIFY_LOCALES = ['en', 'fr'];
|
|
2043
|
+
// A fixture context's name (space-test-server.js checks fixtures with it): it joins the image name only when the
|
|
2044
|
+
// fixtures declare several, after a dot, which no Space key has, so `view-a.b-...` is never Space `a-b`'s image.
|
|
2045
|
+
export const VERIFY_CONTEXT_NAME = /^[a-z0-9][a-z0-9_-]{0,31}$/;
|
|
2046
|
+
function contextPart(context, message) {
|
|
2047
|
+
if (context === undefined) return '';
|
|
2048
|
+
if (typeof context !== 'string' || !VERIFY_CONTEXT_NAME.test(context)) throw usageError(message);
|
|
2049
|
+
return `.${context}`;
|
|
2047
2050
|
}
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
+
/**
|
|
2052
|
+
* Each Space's verify images carry its key, so two Spaces verified from one folder never share a file:
|
|
2053
|
+
* `view-<key>[.<context>]-<width>-<locale>.png`.
|
|
2054
|
+
*/
|
|
2055
|
+
function viewImageName(key, width, locale, context) {
|
|
2056
|
+
if (!VERIFY_WIDTHS.includes(width) || !VERIFY_LOCALES.includes(locale)) throw usageError('Unsafe screenshot name.');
|
|
2057
|
+
return `view-${assertSpaceKey(key, 'Unsafe screenshot name.')}${contextPart(context, 'Unsafe screenshot name.')}-${width}-${locale}.png`;
|
|
2058
|
+
}
|
|
2059
|
+
/** `pending-<key>[.<context>][.reader]-<width>-<locale>.png`; `reader` is an opened item's loading state. */
|
|
2060
|
+
function pendingImageName(key, width, locale, { context, state } = {}) {
|
|
2061
|
+
if (!VERIFY_WIDTHS.includes(width) || !VERIFY_LOCALES.includes(locale) || (state !== undefined && state !== 'reader')) {
|
|
2062
|
+
throw usageError('Unsafe pending screenshot name.');
|
|
2063
|
+
}
|
|
2064
|
+
return `pending-${assertSpaceKey(key, 'Unsafe pending screenshot name.')}${contextPart(context, 'Unsafe pending screenshot name.')}${state ? `.${state}` : ''}-${width}-${locale}.png`;
|
|
2065
|
+
}
|
|
2066
|
+
// The names of the images the last verify of a Space wrote: names carrying a context cannot be listed in advance, and
|
|
2067
|
+
// matching them by pattern could take another Space's images whose key starts with this one's.
|
|
2068
|
+
const imageIndexName = key => `verify-images-${key}.json`;
|
|
2069
|
+
function readImageIndex(key) {
|
|
2070
|
+
const name = imageIndexName(key), stat = lstatSync(name, { throwIfNoEntry: false });
|
|
2071
|
+
if (!stat?.isFile() || stat.size > 64 * 1024) return [];
|
|
2072
|
+
try {
|
|
2073
|
+
const names = JSON.parse(readFileSync(name, 'utf8'));
|
|
2074
|
+
const own = new RegExp(`^(?:view|pending)-${key}(?:\\.[a-z0-9_-]+){0,2}-(?:390|1440)-(?:en|fr)\\.png$`);
|
|
2075
|
+
return Array.isArray(names) ? names.filter(value => typeof value === 'string' && own.test(value)) : [];
|
|
2076
|
+
} catch { return []; }
|
|
2077
|
+
}
|
|
2078
|
+
function recordImages(key, names) {
|
|
2079
|
+
const known = [...new Set([...readImageIndex(key), ...names])];
|
|
2080
|
+
replaceVerifyImage(imageIndexName(key), Buffer.from(JSON.stringify(known)));
|
|
2051
2081
|
}
|
|
2052
2082
|
|
|
2053
2083
|
/**
|
|
@@ -2063,39 +2093,53 @@ export function clearSpaceScreenshots(projectDir, key) {
|
|
|
2063
2093
|
|
|
2064
2094
|
/** Remove one Space's verify images, and the unnamed ones, from the pinned .notis directory (the working directory). */
|
|
2065
2095
|
function removeSpaceImages(key) {
|
|
2096
|
+
for (const name of readImageIndex(key)) replaceVerifyImage(name);
|
|
2097
|
+
replaceVerifyImage(imageIndexName(key));
|
|
2066
2098
|
for (const width of VERIFY_WIDTHS) {
|
|
2067
|
-
|
|
2099
|
+
// Names of older CLIs: one view image per width, with and without the key.
|
|
2100
|
+
replaceVerifyImage(`view-${key}-${width}.png`);
|
|
2068
2101
|
replaceVerifyImage(`view-${width}.png`);
|
|
2069
2102
|
for (const locale of VERIFY_LOCALES) {
|
|
2103
|
+
replaceVerifyImage(viewImageName(key, width, locale));
|
|
2070
2104
|
replaceVerifyImage(pendingImageName(key, width, locale));
|
|
2105
|
+
replaceVerifyImage(pendingImageName(key, width, locale, { state: 'reader' }));
|
|
2071
2106
|
replaceVerifyImage(`pending-${width}-${locale}.png`);
|
|
2072
2107
|
}
|
|
2073
2108
|
}
|
|
2074
2109
|
}
|
|
2075
2110
|
|
|
2076
|
-
/**
|
|
2111
|
+
/**
|
|
2112
|
+
* The loading-state screenshots of the last verify, `pending-<key>[.<context>][.reader]-<width>-<locale>.png` beside
|
|
2113
|
+
* the diagnostic.
|
|
2114
|
+
*/
|
|
2077
2115
|
export function saveSpacePendingScreenshots(projectDir, key, screenshots) {
|
|
2078
2116
|
if (!screenshots?.length) return [];
|
|
2079
2117
|
// Every name is checked before any file is written.
|
|
2080
|
-
const names = screenshots.map(({ width, locale }) => pendingImageName(key, width, locale));
|
|
2081
|
-
return withAppReleaseWorkspace(projectDir, (workspace) =>
|
|
2082
|
-
|
|
2083
|
-
return
|
|
2084
|
-
|
|
2118
|
+
const names = screenshots.map(({ width, locale, context, state }) => pendingImageName(key, width, locale, { context, state }));
|
|
2119
|
+
return withAppReleaseWorkspace(projectDir, (workspace) => {
|
|
2120
|
+
recordImages(key, names);
|
|
2121
|
+
return screenshots.map(({ png }, index) => {
|
|
2122
|
+
replaceVerifyImage(names[index], png);
|
|
2123
|
+
return join(workspace.projectDir, NOTIS_DIR, names[index]);
|
|
2124
|
+
});
|
|
2125
|
+
});
|
|
2085
2126
|
}
|
|
2086
2127
|
|
|
2087
2128
|
/**
|
|
2088
|
-
* The screenshots of the last verify, `view-<key>-<
|
|
2089
|
-
* its data (or of what it showed when it had not).
|
|
2129
|
+
* The screenshots of the last verify, `view-<key>[.<context>]-<width>-<locale>.png` beside the diagnostic, taken once
|
|
2130
|
+
* the view had loaded its data (or of what it showed when it had not). Each comes back with its width, locale and
|
|
2131
|
+
* context and the path it was saved at.
|
|
2090
2132
|
*/
|
|
2091
2133
|
export function saveSpaceScreenshots(projectDir, key, screenshots) {
|
|
2092
|
-
// One image per width, every name checked before any file is written.
|
|
2093
|
-
const kept = new Map((screenshots || []).map(value => [value.width, value]));
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2134
|
+
// One image per width, locale and context, every name checked before any file is written.
|
|
2135
|
+
const kept = new Map((screenshots || []).map(value => [viewImageName(key, value.width, value.locale || 'en', value.context), value]));
|
|
2136
|
+
return withAppReleaseWorkspace(projectDir, (workspace) => {
|
|
2137
|
+
recordImages(key, [...kept.keys()]);
|
|
2138
|
+
return [...kept].map(([name, { width, locale = 'en', context, png }]) => {
|
|
2139
|
+
replaceVerifyImage(name, png);
|
|
2140
|
+
return { width, locale, ...(context ? { context } : {}), path: join(workspace.projectDir, NOTIS_DIR, name) };
|
|
2141
|
+
});
|
|
2142
|
+
});
|
|
2099
2143
|
}
|
|
2100
2144
|
|
|
2101
2145
|
/** Retain the original CAS after an uncertain publish response, across CLI exits. */
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Node's fetch gives up on any answer that takes longer than 300 s to start (headersTimeout) or
|
|
3
|
+
* pauses longer than 300 s mid-body (bodyTimeout), and reports it as a bare "fetch failed". The
|
|
4
|
+
* CLI already bounds every request with its own AbortSignal (--timeout-ms, or a longer limit a
|
|
5
|
+
* command sets), so these requests go through an agent without those two hidden limits: the
|
|
6
|
+
* caller's signal is the one deadline, and its timeout message is the one a user reads.
|
|
7
|
+
*
|
|
8
|
+
* Only pass this dispatcher with a signal that ends the request.
|
|
9
|
+
*/
|
|
10
|
+
let agent;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Node's own fetch sends through HTTP_PROXY / HTTPS_PROXY (and honours NO_PROXY) only when its env
|
|
14
|
+
* proxy is on (NODE_USE_ENV_PROXY=1 or --use-env-proxy). A plain Agent would connect directly, so
|
|
15
|
+
* that case keeps the proxy with undici's EnvHttpProxyAgent, which reads the same variables.
|
|
16
|
+
*/
|
|
17
|
+
export function nodeEnvProxyEnabled(env = process.env, execArgv = process.execArgv) {
|
|
18
|
+
// As Node decides: the last --use-env-proxy / --no-use-env-proxy wins (NODE_OPTIONS, then the command line),
|
|
19
|
+
// and without either flag only NODE_USE_ENV_PROXY=1 turns it on.
|
|
20
|
+
const flags = [...String(env.NODE_OPTIONS || '').split(/\s+/), ...execArgv]
|
|
21
|
+
.filter(flag => flag === '--use-env-proxy' || flag === '--no-use-env-proxy');
|
|
22
|
+
return flags.length ? flags.at(-1) === '--use-env-proxy' : env.NODE_USE_ENV_PROXY === '1';
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export async function deadlineDispatcher() {
|
|
26
|
+
if (agent === undefined) {
|
|
27
|
+
try {
|
|
28
|
+
const { Agent, EnvHttpProxyAgent } = await import('undici');
|
|
29
|
+
const options = { headersTimeout: 0, bodyTimeout: 0 };
|
|
30
|
+
agent = nodeEnvProxyEnabled() ? new EnvHttpProxyAgent(options) : new Agent(options);
|
|
31
|
+
} catch {
|
|
32
|
+
// A checkout whose dependencies predate undici keeps Node's default agent and its 300 s limits.
|
|
33
|
+
agent = null;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return agent ?? undefined;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
// A connect timeout is undici's own 10 s, not a slow answer: it stays a network_error naming UND_ERR_CONNECT_TIMEOUT.
|
|
40
|
+
const TIMEOUT_CODES = new Set(['UND_ERR_HEADERS_TIMEOUT', 'UND_ERR_BODY_TIMEOUT']);
|
|
41
|
+
|
|
42
|
+
/** The network code under fetch's bare "fetch failed" (ECONNRESET, ENOTFOUND, UND_ERR_SOCKET, ...), when there is one. */
|
|
43
|
+
export function networkCauseCode(error) {
|
|
44
|
+
for (let value = error, depth = 0; value && depth < 4; value = value.cause, depth += 1) {
|
|
45
|
+
if (typeof value.code === 'string' && value.code) return value.code;
|
|
46
|
+
}
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** True when the transport itself stopped waiting for an answer (not our own AbortSignal). */
|
|
51
|
+
export function isTransportTimeout(error) {
|
|
52
|
+
return TIMEOUT_CODES.has(networkCauseCode(error));
|
|
53
|
+
}
|
|
@@ -6,6 +6,16 @@ import { usageError } from './errors.js';
|
|
|
6
6
|
|
|
7
7
|
const MAX_BYTES = 8 * 1024 * 1024;
|
|
8
8
|
const UUID = /^[a-f0-9]{8}(?:-[a-f0-9]{4}){3}-[a-f0-9]{12}$/i;
|
|
9
|
+
// Same rule as the server (server/lib/env_file_names.py): env files hold secrets and are never stored.
|
|
10
|
+
export const ENV_FILE_MESSAGE = 'Env files (.env, .env.*, *.env) hold secrets such as API keys and are never stored. '
|
|
11
|
+
+ 'Nothing was uploaded. Share the setting names without their values instead.';
|
|
12
|
+
|
|
13
|
+
/** Whether a file name or path names a developer env file: server/lib/env_file_names.py's rule, kept the same. */
|
|
14
|
+
export function isEnvFileName(value) {
|
|
15
|
+
const name = String(value || '').replace(/\\/g, '/').replace(/\/+$/, '').split('/').pop().trim().toLowerCase();
|
|
16
|
+
return /^\.env(?:[._-][\s\S]*|rc)?$/.test(name) || name.endsWith('.env');
|
|
17
|
+
}
|
|
18
|
+
|
|
9
19
|
const MIME = { '.html': 'text/html', '.htm': 'text/html', '.txt': 'text/plain', '.md': 'text/markdown',
|
|
10
20
|
'.json': 'application/json', '.pdf': 'application/pdf', '.png': 'image/png', '.jpg': 'image/jpeg', '.jpeg': 'image/jpeg', '.webp': 'image/webp' };
|
|
11
21
|
|
|
@@ -17,6 +27,7 @@ export async function uploadNativeRecordFileWithCliRuntime({ runtime, target, re
|
|
|
17
27
|
|| !target || typeof target !== 'object' || Array.isArray(target) || !filePath) {
|
|
18
28
|
throw usageError('Choose a local file, native target, record key, schema revision and stable request ID.');
|
|
19
29
|
}
|
|
30
|
+
if (isEnvFileName(filePath) || isEnvFileName(name)) throw usageError(ENV_FILE_MESSAGE);
|
|
20
31
|
const handle = await open(filePath, 'r');
|
|
21
32
|
let data;
|
|
22
33
|
try {
|
package/src/runtime/oauth.js
CHANGED
|
@@ -651,7 +651,8 @@ function connectedCallbackHtml({ portalOrigin }) {
|
|
|
651
651
|
transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
|
|
652
652
|
}
|
|
653
653
|
.button:hover { transform: translateY(-1px); border-color: #454b57; background: #1b1e24; }
|
|
654
|
-
.button:focus-visible {
|
|
654
|
+
.button:focus-visible { border-color: var(--focus); }
|
|
655
|
+
@media (forced-colors: none) { :focus, :focus-visible { outline: none; } }
|
|
655
656
|
.button-primary { border-color: var(--primary); background: var(--primary); color: var(--primary-ink); }
|
|
656
657
|
.button-primary:hover { border-color: #fff; background: #fff; }
|
|
657
658
|
.helper { margin: 12px 0 0; color: #777f8d; font-size: 0.78rem; line-height: 1.45; }
|
|
@@ -149,16 +149,6 @@ export async function pushChangedSkills(
|
|
|
149
149
|
return { skills: saved, ...(failed.length ? { failed } : {}) };
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
-
export async function downloadSkillBundle(bundleUrl: string): Promise<Buffer> {
|
|
153
|
-
const response = await fetch(bundleUrl, { signal: AbortSignal.timeout(90_000) });
|
|
154
|
-
if (!response.ok) {
|
|
155
|
-
const text = await response.text();
|
|
156
|
-
throw new Error(`GET ${bundleUrl} → ${response.status}: ${text}`);
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
return Buffer.from(await response.arrayBuffer());
|
|
160
|
-
}
|
|
161
|
-
|
|
162
152
|
export async function updateAgentTargets(
|
|
163
153
|
serverUrl: string,
|
|
164
154
|
jwt: string,
|
|
@@ -15,7 +15,6 @@ import { normalizeAgentTargets } from "./types";
|
|
|
15
15
|
import { assertNativePull, checkedNativeReference, isNativeSkill, nativeState } from './native-identity';
|
|
16
16
|
import { bindNativeFolders, hasNativeFolderHistory, nativeLinkRows, nativeLocalReady, pendingLegacyUpgrade, previousNativeState, retainMissingNativeState } from './native-plan';
|
|
17
17
|
import {
|
|
18
|
-
downloadSkillBundle,
|
|
19
18
|
fetchSyncSettings,
|
|
20
19
|
pullSkills,
|
|
21
20
|
pushChangedSkills,
|
|
@@ -39,7 +38,7 @@ import {
|
|
|
39
38
|
type DeletedAgentSymlink,
|
|
40
39
|
} from "./symlink-manager";
|
|
41
40
|
import { getPushCandidates, selectCloudSkillsToApply } from "./sync-plan";
|
|
42
|
-
import {
|
|
41
|
+
import { writeCloudSkill } from "./write-cloud-skill";
|
|
43
42
|
export { fetchSyncSettings, pushChangedSkills } from './cloud-client';
|
|
44
43
|
|
|
45
44
|
export interface RunSkillSyncResult {
|
|
@@ -115,7 +114,6 @@ interface RunSkillSyncDependencies {
|
|
|
115
114
|
fetchSyncSettings: typeof fetchSyncSettings;
|
|
116
115
|
pullSkills: typeof pullSkills;
|
|
117
116
|
pushChangedSkills: typeof pushChangedSkills;
|
|
118
|
-
downloadSkillBundle: typeof downloadSkillBundle;
|
|
119
117
|
gatherTopLevelLocalSkills: typeof gatherTopLevelLocalSkills;
|
|
120
118
|
readLegacySyncState: typeof readLegacySyncState;
|
|
121
119
|
readSyncState: typeof readSyncState;
|
|
@@ -134,7 +132,6 @@ const DEFAULT_RUN_SKILL_SYNC_DEPS: RunSkillSyncDependencies = {
|
|
|
134
132
|
fetchSyncSettings,
|
|
135
133
|
pullSkills,
|
|
136
134
|
pushChangedSkills,
|
|
137
|
-
downloadSkillBundle,
|
|
138
135
|
gatherTopLevelLocalSkills,
|
|
139
136
|
readLegacySyncState,
|
|
140
137
|
readSyncState,
|
|
@@ -239,7 +236,10 @@ function cloudContentHash(skill: SyncPullResponse['skills'][number]): string {
|
|
|
239
236
|
return createHash('sha256').update(JSON.stringify({
|
|
240
237
|
md: skill.skill_md,
|
|
241
238
|
hash: skill.skill_folder_hash,
|
|
242
|
-
|
|
239
|
+
// A recorded origin is provenance, never content (SKL-059): a URL hashes as null so
|
|
240
|
+
// it cannot force a rewrite, and an absent or null one hashes as before so stored
|
|
241
|
+
// hashes stay valid.
|
|
242
|
+
source: skill.skill_source_url ? null : skill.skill_source_url,
|
|
243
243
|
files: skill.bundle_files?.slice().sort((a, b) => a.path.localeCompare(b.path)),
|
|
244
244
|
hydrationFailed: skill.bundle_hydration_failed === true,
|
|
245
245
|
})).digest('hex');
|
|
@@ -270,8 +270,8 @@ export function shouldWriteCloudSkill(
|
|
|
270
270
|
if (previous?.folderHash === localSkill.folderHash
|
|
271
271
|
&& previous.cloudContentHash === cloudContentHash(cloudSkill)) return false;
|
|
272
272
|
|
|
273
|
-
// Without a stored content baseline (
|
|
274
|
-
//
|
|
273
|
+
// Without a stored content baseline (a state file written by an older client for a
|
|
274
|
+
// Skill it fetched through a source URL keeps none) the only other signal is
|
|
275
275
|
// `skill_folder_hash`, which the server does NOT always compute the way the local
|
|
276
276
|
// folder hash is computed. A bundle-entry hash can never equal the hash of the
|
|
277
277
|
// extracted directory, and comparing the two replaced the folder on every sync
|
|
@@ -379,7 +379,7 @@ function buildSyncState(
|
|
|
379
379
|
agentTargets: normalizeAgentTargets(skill.agent_targets),
|
|
380
380
|
verifiedAgentLinks: skill.status === "active" ? verifiedAgentLinks[skill.name] ?? {} : {},
|
|
381
381
|
cloudUpdatedAt: skill.updated_at,
|
|
382
|
-
...(!failedContentNames.has(skill.name)
|
|
382
|
+
...(!failedContentNames.has(skill.name)
|
|
383
383
|
? { cloudContentHash: cloudContentHash(skill) } : {}),
|
|
384
384
|
...(appliedCloudFolderHash !== undefined ? { appliedCloudFolderHash } : {}),
|
|
385
385
|
...(appliedFileList !== undefined ? { appliedFiles: appliedFileList } : {}),
|
|
@@ -512,7 +512,7 @@ async function writePulledSkillsToScopedMirror(
|
|
|
512
512
|
syncPaths: ReturnType<typeof getSkillSyncPathsForUser>,
|
|
513
513
|
deps: Pick<
|
|
514
514
|
RunSkillSyncDependencies,
|
|
515
|
-
"
|
|
515
|
+
"writeCloudSkillToDisk"
|
|
516
516
|
>,
|
|
517
517
|
failures: SkillSyncFailure[] = [],
|
|
518
518
|
writtenSkillNames: Set<string> = new Set(),
|
|
@@ -539,10 +539,9 @@ async function writePulledSkillsToScopedMirror(
|
|
|
539
539
|
continue;
|
|
540
540
|
}
|
|
541
541
|
|
|
542
|
-
const outcome = await
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
deps.writeCloudSkillToDisk(skill, bundleBytes, syncPaths, {
|
|
542
|
+
const outcome = await writeCloudSkill(cloudSkill, {
|
|
543
|
+
writeCloudSkillToDisk: (skill) =>
|
|
544
|
+
deps.writeCloudSkillToDisk(skill, syncPaths, {
|
|
546
545
|
// What the last write put there. Everything else in the folder was
|
|
547
546
|
// produced locally and survives this one.
|
|
548
547
|
previouslyApplied: previouslyAppliedFiles(skill, local, previousState),
|
|
@@ -558,7 +557,7 @@ async function writePulledSkillsToScopedMirror(
|
|
|
558
557
|
appliedFilesByName[cloudSkill.name] = outcome.appliedFiles;
|
|
559
558
|
}
|
|
560
559
|
} else {
|
|
561
|
-
failures.push({ name: cloudSkill.name, error: "Skill content could not be
|
|
560
|
+
failures.push({ name: cloudSkill.name, error: "Skill content could not be written; sync will retry" });
|
|
562
561
|
}
|
|
563
562
|
}
|
|
564
563
|
|
|
@@ -589,7 +588,6 @@ export async function materializeCloudSkillsForLocalShell(
|
|
|
589
588
|
jwt: string,
|
|
590
589
|
dependencies: Partial<Pick<
|
|
591
590
|
RunSkillSyncDependencies,
|
|
592
|
-
| "downloadSkillBundle"
|
|
593
591
|
| "deleteLocalSkill"
|
|
594
592
|
| "pullSkills"
|
|
595
593
|
| "readSyncState"
|