@pulsarinteractive/geniustasker 0.1.0-beta.11 → 0.1.0-beta.13
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/CHANGELOG.md +22 -0
- package/README.md +14 -1
- package/docs/ARCHITECTURE.md +15 -13
- package/docs/CHATGPT.md +6 -0
- package/docs/CLI.md +153 -5
- package/docs/INTEGRATIONS.md +25 -2
- package/docs/MEMORY.md +9 -0
- package/docs/WORKFLOWS.md +14 -0
- package/examples/codex.toml +1 -1
- package/examples/mcp.json +1 -1
- package/mcp.json +1 -1
- package/package.json +2 -2
- package/plugin.json +1 -1
- package/remote/tool-catalog.json +296 -1
- package/remote/workflows.json +53 -2
- package/skills/geniustasker/SKILL.md +15 -1
- package/skills/geniustasker/references/agent-runs.md +144 -0
- package/skills/geniustasker/references/host-events.md +116 -0
- package/skills/geniustasker/references/importance.md +90 -0
- package/skills/geniustasker/references/metric-goals.md +143 -0
- package/skills/geniustasker/references/metrics-observations.md +184 -0
- package/skills/geniustasker/references/metrics.md +136 -0
- package/skills/geniustasker/references/protocols.md +156 -0
- package/skills/geniustasker/references/updates.md +31 -0
- package/skills/geniustasker-graph/SKILL.md +10 -0
- package/skills/geniustasker-memory/SKILL.md +19 -6
- package/skills/geniustasker-memory/references/knowledge-workflows.md +42 -0
- package/skills/geniustasker-planning/SKILL.md +6 -1
- package/src/changes.mjs +3 -5
- package/src/cli.mjs +108 -14
- package/src/command-catalog.mjs +849 -562
- package/src/command-input-schemas.d.mts +8 -0
- package/src/command-input-schemas.mjs +1021 -0
- package/src/commands.mjs +78 -25
- package/src/mcp.mjs +48 -20
- package/src/protocols.mjs +122 -0
- package/src/resources.mjs +98 -0
- package/src/run-events.mjs +145 -0
- package/src/update-runtime.mjs +169 -0
- package/src/update.mjs +306 -0
package/src/changes.mjs
CHANGED
|
@@ -4,14 +4,11 @@ import { AgentClient } from './client.mjs';
|
|
|
4
4
|
import { Transport } from './transport.mjs';
|
|
5
5
|
import catalog from './command-catalog.mjs';
|
|
6
6
|
import { fail } from './errors.mjs';
|
|
7
|
+
import { resourceScopeSchema, validateResourceScope } from './resources.mjs';
|
|
7
8
|
|
|
8
9
|
export const changesSchema = z
|
|
9
10
|
.object({
|
|
10
|
-
scope:
|
|
11
|
-
.string()
|
|
12
|
-
.max(256)
|
|
13
|
-
// eslint-disable-next-line no-control-regex -- Reject control characters in untrusted input.
|
|
14
|
-
.regex(/^(project|memory):[^\u0000-\u001f]+$/u),
|
|
11
|
+
scope: resourceScopeSchema,
|
|
15
12
|
collection: z.string().min(1).max(32),
|
|
16
13
|
cursor: z.string().min(1).max(4096),
|
|
17
14
|
})
|
|
@@ -59,6 +56,7 @@ function query(input, schema) {
|
|
|
59
56
|
'Use a project or memory scope, collection and unchanged change cursor; waitSeconds must be within the supported bound.',
|
|
60
57
|
);
|
|
61
58
|
}
|
|
59
|
+
validateResourceScope(parsed.data);
|
|
62
60
|
return parsed.data;
|
|
63
61
|
}
|
|
64
62
|
/** Validate the entire bounded page before a caller can adopt its next cursor. */
|
package/src/cli.mjs
CHANGED
|
@@ -11,15 +11,28 @@ import { CredentialStore } from './store.mjs';
|
|
|
11
11
|
import { ORIGINS, originOf, Transport } from './transport.mjs';
|
|
12
12
|
import { AgentClient } from './client.mjs';
|
|
13
13
|
import { deviceLogin, browserLogin } from './login.mjs';
|
|
14
|
-
import { CommandJournal, describeCommands, readCommandFile } from './commands.mjs';
|
|
14
|
+
import { CommandJournal, describeCommands, commandHelp, readCommandFile } from './commands.mjs';
|
|
15
15
|
import { AgentProfiles } from './profiles.mjs';
|
|
16
16
|
import { readChanges, watchChanges } from './changes.mjs';
|
|
17
17
|
import { readMemoryTree, readMemoryMarkdown } from './documentation.mjs';
|
|
18
18
|
import { searchMemory, exploreGraph, resolveMemory } from './knowledge.mjs';
|
|
19
|
+
import { previewProtocol } from './protocols.mjs';
|
|
20
|
+
import { reportRunEvent } from './run-events.mjs';
|
|
21
|
+
import { readResources, readMetrics } from './resources.mjs';
|
|
19
22
|
import { MediaJournal, mediaAction, downloadMedia, compareMedia } from './media.mjs';
|
|
20
23
|
import { fail, safeError, exitCode } from './errors.mjs';
|
|
24
|
+
import { checkUpdate, installUpdate, maybeNotifyUpdate } from './update.mjs';
|
|
25
|
+
import { acquireRuntime } from './update-runtime.mjs';
|
|
21
26
|
|
|
22
27
|
export const commands = {
|
|
28
|
+
'update check': {
|
|
29
|
+
summary: 'Check the official npm registry for this installation channel; no account access.',
|
|
30
|
+
options: ['channel'],
|
|
31
|
+
},
|
|
32
|
+
'update install': {
|
|
33
|
+
summary: 'Explicitly update a global npm installation when no CLI or MCP process is active.',
|
|
34
|
+
options: ['channel'],
|
|
35
|
+
},
|
|
23
36
|
'workflow show': { summary: 'Read a reviewed workflow guide; no network.', options: ['topic'] },
|
|
24
37
|
'auth login': {
|
|
25
38
|
summary: 'Open browser sign-in and choose access. No tutorial or token to copy.',
|
|
@@ -58,6 +71,11 @@ export const commands = {
|
|
|
58
71
|
summary: 'List independent account memories; follow nextAfter even for an empty page.',
|
|
59
72
|
options: ['after'],
|
|
60
73
|
},
|
|
74
|
+
'metrics list': {
|
|
75
|
+
summary:
|
|
76
|
+
'Read one bounded page of custom metric definitions (default), observations, corrections or linked goals. Select --collection; requires metrics:read.',
|
|
77
|
+
options: ['scope', 'collection', 'id', 'metric-id', 'after', 'epoch', 'checkpoint', 'archive'],
|
|
78
|
+
},
|
|
61
79
|
'media compare': {
|
|
62
80
|
summary: 'Compare a local file with an existing resource before uploading a replacement.',
|
|
63
81
|
options: ['scope', 'id', 'file'],
|
|
@@ -115,9 +133,28 @@ export const commands = {
|
|
|
115
133
|
summary: 'Read a bounded project page; follow nextAfter even for an empty page.',
|
|
116
134
|
options: ['after'],
|
|
117
135
|
},
|
|
136
|
+
'protocols preview': {
|
|
137
|
+
summary: 'Preview one page of a published task protocol from JSON without creating tasks.',
|
|
138
|
+
options: ['file'],
|
|
139
|
+
},
|
|
140
|
+
'runs event': {
|
|
141
|
+
summary:
|
|
142
|
+
'Journal one real host event and send it once; --prepare only saves it. No process monitoring.',
|
|
143
|
+
options: ['file', 'prepare'],
|
|
144
|
+
},
|
|
118
145
|
'resources list': {
|
|
119
146
|
summary: 'Read a project or memory collection; carry epoch/checkpoint when continuing.',
|
|
120
|
-
options: [
|
|
147
|
+
options: [
|
|
148
|
+
'scope',
|
|
149
|
+
'collection',
|
|
150
|
+
'after',
|
|
151
|
+
'epoch',
|
|
152
|
+
'checkpoint',
|
|
153
|
+
'archive',
|
|
154
|
+
'id',
|
|
155
|
+
'path',
|
|
156
|
+
'metric-id',
|
|
157
|
+
],
|
|
121
158
|
},
|
|
122
159
|
'changes list': {
|
|
123
160
|
summary:
|
|
@@ -136,7 +173,7 @@ export const commands = {
|
|
|
136
173
|
},
|
|
137
174
|
'commands describe': {
|
|
138
175
|
summary: 'Show contract-derived command fields and JSON schemas; no network.',
|
|
139
|
-
options: [],
|
|
176
|
+
options: ['kind'],
|
|
140
177
|
},
|
|
141
178
|
'commands prepare': {
|
|
142
179
|
summary: 'Save an immutable operation from a JSON draft without sending it.',
|
|
@@ -166,7 +203,7 @@ export const commands = {
|
|
|
166
203
|
help: { summary: 'Describe commands and stable output conventions.', options: [] },
|
|
167
204
|
};
|
|
168
205
|
const globalOptions = ['json', 'context', 'environment', 'origin', 'allow-local', 'help'];
|
|
169
|
-
const flags = new Set(['json', 'allow-local', 'help', 'interactive', 'no-browser']);
|
|
206
|
+
const flags = new Set(['json', 'allow-local', 'help', 'interactive', 'no-browser', 'prepare']);
|
|
170
207
|
export function parse(argv) {
|
|
171
208
|
const options = {},
|
|
172
209
|
words = [];
|
|
@@ -256,8 +293,15 @@ export async function main(
|
|
|
256
293
|
fetchImpl,
|
|
257
294
|
signal,
|
|
258
295
|
openBrowserImpl = openConsent,
|
|
296
|
+
updateFetchImpl,
|
|
297
|
+
updateCacheDirectory,
|
|
298
|
+
updateEnvironment,
|
|
299
|
+
updateNpmImpl,
|
|
300
|
+
updateInstalledDirectory,
|
|
301
|
+
runtimeDirectory,
|
|
259
302
|
} = {},
|
|
260
303
|
) {
|
|
304
|
+
let releaseRuntime;
|
|
261
305
|
try {
|
|
262
306
|
const { command, options } = parse(argv);
|
|
263
307
|
const emit = (data) =>
|
|
@@ -268,6 +312,20 @@ export async function main(
|
|
|
268
312
|
emit(help(command));
|
|
269
313
|
return 0;
|
|
270
314
|
}
|
|
315
|
+
if (command === 'update check' || command === 'update install') {
|
|
316
|
+
emit(
|
|
317
|
+
await (command === 'update check' ? checkUpdate : installUpdate)({
|
|
318
|
+
channel: options.channel,
|
|
319
|
+
fetchImpl: updateFetchImpl,
|
|
320
|
+
signal,
|
|
321
|
+
npmImpl: updateNpmImpl,
|
|
322
|
+
installedDirectory: updateInstalledDirectory,
|
|
323
|
+
runtimeDirectory,
|
|
324
|
+
}),
|
|
325
|
+
);
|
|
326
|
+
return 0;
|
|
327
|
+
}
|
|
328
|
+
releaseRuntime = await acquireRuntime(runtimeDirectory);
|
|
271
329
|
if (options.environment && !Object.hasOwn(ORIGINS, options.environment)) {
|
|
272
330
|
fail('invalid_arguments', 'Environment must be production or development.');
|
|
273
331
|
}
|
|
@@ -341,10 +399,16 @@ export async function main(
|
|
|
341
399
|
data = await new AgentProfiles(client).restrict(await readCommandFile(options.file));
|
|
342
400
|
} else if (command === 'profiles select') {
|
|
343
401
|
data = await new AgentProfiles(client).select({ profileId: options.profile });
|
|
402
|
+
} else if (command === 'protocols preview') {
|
|
403
|
+
data = await previewProtocol(client, await readCommandFile(options.file));
|
|
404
|
+
} else if (command === 'runs event') {
|
|
405
|
+
data = await reportRunEvent(client, await readCommandFile(options.file), {
|
|
406
|
+
prepareOnly: options.prepare === true,
|
|
407
|
+
});
|
|
344
408
|
} else if (command === 'workflow show') {
|
|
345
409
|
data = workflow({ topic: options.topic });
|
|
346
410
|
} else if (command === 'commands describe') {
|
|
347
|
-
data = describeCommands();
|
|
411
|
+
data = options.kind ? commandHelp({ kind: options.kind }) : describeCommands();
|
|
348
412
|
} else if (command === 'commands prepare') {
|
|
349
413
|
data = await new CommandJournal(client).prepare(await readCommandFile(options.file));
|
|
350
414
|
} else if (command === 'commands execute') {
|
|
@@ -467,28 +531,41 @@ export async function main(
|
|
|
467
531
|
...(input.block === undefined ? {} : { blockId: input.block }),
|
|
468
532
|
});
|
|
469
533
|
}
|
|
534
|
+
} else if (command === 'metrics list') {
|
|
535
|
+
const input = Object.fromEntries(
|
|
536
|
+
commands[command].options
|
|
537
|
+
.filter((key) => options[key] !== undefined)
|
|
538
|
+
.map((key) => [key === 'metric-id' ? 'metricId' : key, options[key]]),
|
|
539
|
+
);
|
|
540
|
+
data = await readMetrics(client, {
|
|
541
|
+
...input,
|
|
542
|
+
collection:
|
|
543
|
+
options.collection ??
|
|
544
|
+
(options.scope?.startsWith('personal:') ? 'personalMetrics' : 'metrics'),
|
|
545
|
+
});
|
|
470
546
|
} else if (command === 'resources list' || command === 'questions answers') {
|
|
471
547
|
if (
|
|
472
548
|
!(command === 'questions answers'
|
|
473
549
|
? options.scope?.startsWith('project:')
|
|
474
550
|
: // eslint-disable-next-line no-control-regex -- Reject control characters in untrusted input.
|
|
475
|
-
/^(project|memory):[^\u0000-\u001f]+$/.test(options.scope ?? '')) ||
|
|
551
|
+
/^(project|memory|personal):[^\u0000-\u001f]+$/.test(options.scope ?? '')) ||
|
|
476
552
|
!(command === 'resources list' ? options.collection : options.question) ||
|
|
477
553
|
(options.after && (!options.epoch || !options.checkpoint))
|
|
478
554
|
) {
|
|
479
555
|
fail(
|
|
480
556
|
'invalid_arguments',
|
|
481
|
-
'Use --scope project:ID or memory:ID and --collection for resources or --question for answers;
|
|
557
|
+
'Use --scope project:ID or memory:ID and --collection for resources or --question for answers; personal:<connected-owner> is limited to metric definitions, observations and corrections. Continuation needs --epoch and --checkpoint.',
|
|
482
558
|
);
|
|
483
559
|
}
|
|
484
|
-
|
|
485
|
-
command
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
.filter((key) => options[key] !== undefined)
|
|
489
|
-
.map((key) => [key, options[key]]),
|
|
490
|
-
),
|
|
560
|
+
const input = Object.fromEntries(
|
|
561
|
+
commands[command].options
|
|
562
|
+
.filter((key) => options[key] !== undefined)
|
|
563
|
+
.map((key) => [key === 'metric-id' ? 'metricId' : key, options[key]]),
|
|
491
564
|
);
|
|
565
|
+
data =
|
|
566
|
+
command === 'resources list'
|
|
567
|
+
? await readResources(client, input)
|
|
568
|
+
: await client.get('answers', input);
|
|
492
569
|
} else if (command === 'mcp') {
|
|
493
570
|
const { runMcp } = await import('./mcp.mjs');
|
|
494
571
|
const server = await runMcp(client);
|
|
@@ -499,13 +576,30 @@ export async function main(
|
|
|
499
576
|
if (signal?.aborted) {
|
|
500
577
|
close();
|
|
501
578
|
}
|
|
579
|
+
// The stdio server outlives main(). Keep its lease until process exit;
|
|
580
|
+
// replacing files while a host could call a tool is unsafe.
|
|
581
|
+
releaseRuntime = undefined;
|
|
502
582
|
return 0; // stdout belongs exclusively to JSON-RPC.
|
|
503
583
|
}
|
|
504
584
|
emit(data);
|
|
585
|
+
await maybeNotifyUpdate({
|
|
586
|
+
command,
|
|
587
|
+
options,
|
|
588
|
+
isTTY,
|
|
589
|
+
stdout,
|
|
590
|
+
stderr,
|
|
591
|
+
signal,
|
|
592
|
+
fetchImpl: updateFetchImpl,
|
|
593
|
+
cacheDirectory: updateCacheDirectory,
|
|
594
|
+
env: updateEnvironment,
|
|
595
|
+
});
|
|
505
596
|
return 0;
|
|
506
597
|
} catch (error) {
|
|
507
598
|
const safe = safeError(error);
|
|
508
599
|
stderr.write(JSON.stringify({ formatVersion: 1, ok: false, error: safe.toJSON() }) + '\n');
|
|
509
600
|
return exitCode(safe);
|
|
601
|
+
} finally {
|
|
602
|
+
// Cleanup cannot turn a confirmed remote receipt into a reported failure.
|
|
603
|
+
await releaseRuntime?.().catch(() => {});
|
|
510
604
|
}
|
|
511
605
|
}
|