@pulsarinteractive/geniustasker 0.1.0-beta.10 → 0.1.0-beta.12

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.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: geniustasker-planning
3
- description: Use when the user asks to plan GeniusTasker tickets in a backlog or sprint, manage projects/sprints/recurrences/documents, customize project tags or saved filters, or review task dependencies.
3
+ description: Use when the user asks to plan GeniusTasker tickets, reuse a task protocol, manage projects/sprints/recurrences/documents, customize project tags or saved filters, or review task dependencies.
4
4
  ---
5
5
 
6
6
  # Plan tasks and shared project workflows
@@ -9,6 +9,11 @@ Inspect identity and capabilities, then read `tasker_workflow` with
9
9
  `topic: planning` for the current transport and product instructions.
10
10
 
11
11
  Read the project configuration, relevant tasks and existing sprint/workflow IDs.
12
+ For reusable multi-task procedures, read [Task protocols](../geniustasker/references/protocols.md)
13
+ and `tasker_workflow` with `topic: protocols`. Preview creates no work; applying
14
+ the requested procedure uses explicit journaled batches with current revisions.
15
+ When creating or reassessing tasks, use [task importance](../geniustasker/references/importance.md)
16
+ to distinguish impact from urgency and preserve human-owned classifications.
12
17
  Use ticket.plan for placement changes and preserve its root and per-task revision
13
18
  checks. Project tags and saved filters are shared configuration; do not turn an
14
19
  example label into a global requirement for every project.
package/src/cli.mjs CHANGED
@@ -11,15 +11,27 @@ 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';
19
21
  import { MediaJournal, mediaAction, downloadMedia, compareMedia } from './media.mjs';
20
22
  import { fail, safeError, exitCode } from './errors.mjs';
23
+ import { checkUpdate, installUpdate, maybeNotifyUpdate } from './update.mjs';
24
+ import { acquireRuntime } from './update-runtime.mjs';
21
25
 
22
26
  export const commands = {
27
+ 'update check': {
28
+ summary: 'Check the official npm registry for this installation channel; no account access.',
29
+ options: ['channel'],
30
+ },
31
+ 'update install': {
32
+ summary: 'Explicitly update a global npm installation when no CLI or MCP process is active.',
33
+ options: ['channel'],
34
+ },
23
35
  'workflow show': { summary: 'Read a reviewed workflow guide; no network.', options: ['topic'] },
24
36
  'auth login': {
25
37
  summary: 'Open browser sign-in and choose access. No tutorial or token to copy.',
@@ -115,6 +127,15 @@ export const commands = {
115
127
  summary: 'Read a bounded project page; follow nextAfter even for an empty page.',
116
128
  options: ['after'],
117
129
  },
130
+ 'protocols preview': {
131
+ summary: 'Preview one page of a published task protocol from JSON without creating tasks.',
132
+ options: ['file'],
133
+ },
134
+ 'runs event': {
135
+ summary:
136
+ 'Journal one real host event and send it once; --prepare only saves it. No process monitoring.',
137
+ options: ['file', 'prepare'],
138
+ },
118
139
  'resources list': {
119
140
  summary: 'Read a project or memory collection; carry epoch/checkpoint when continuing.',
120
141
  options: ['scope', 'collection', 'after', 'epoch', 'checkpoint', 'archive', 'id', 'path'],
@@ -136,7 +157,7 @@ export const commands = {
136
157
  },
137
158
  'commands describe': {
138
159
  summary: 'Show contract-derived command fields and JSON schemas; no network.',
139
- options: [],
160
+ options: ['kind'],
140
161
  },
141
162
  'commands prepare': {
142
163
  summary: 'Save an immutable operation from a JSON draft without sending it.',
@@ -166,7 +187,7 @@ export const commands = {
166
187
  help: { summary: 'Describe commands and stable output conventions.', options: [] },
167
188
  };
168
189
  const globalOptions = ['json', 'context', 'environment', 'origin', 'allow-local', 'help'];
169
- const flags = new Set(['json', 'allow-local', 'help', 'interactive', 'no-browser']);
190
+ const flags = new Set(['json', 'allow-local', 'help', 'interactive', 'no-browser', 'prepare']);
170
191
  export function parse(argv) {
171
192
  const options = {},
172
193
  words = [];
@@ -220,7 +241,7 @@ export function help(command = 'help') {
220
241
  flow: 'browser (default, PKCE loopback) | device (SSH/headless)',
221
242
  browser: 'default (automatic) | chrome; --no-browser prints the link without opening it',
222
243
  scope:
223
- 'space-separated permission ceiling; browser defaults to read-only and requires explicit write selection',
244
+ 'space-separated permission ceiling; official login proposes all requested permissions for review before approval',
224
245
  interactive:
225
246
  'required when starting login without a terminal; never use to bypass human consent',
226
247
  },
@@ -256,8 +277,15 @@ export async function main(
256
277
  fetchImpl,
257
278
  signal,
258
279
  openBrowserImpl = openConsent,
280
+ updateFetchImpl,
281
+ updateCacheDirectory,
282
+ updateEnvironment,
283
+ updateNpmImpl,
284
+ updateInstalledDirectory,
285
+ runtimeDirectory,
259
286
  } = {},
260
287
  ) {
288
+ let releaseRuntime;
261
289
  try {
262
290
  const { command, options } = parse(argv);
263
291
  const emit = (data) =>
@@ -268,6 +296,20 @@ export async function main(
268
296
  emit(help(command));
269
297
  return 0;
270
298
  }
299
+ if (command === 'update check' || command === 'update install') {
300
+ emit(
301
+ await (command === 'update check' ? checkUpdate : installUpdate)({
302
+ channel: options.channel,
303
+ fetchImpl: updateFetchImpl,
304
+ signal,
305
+ npmImpl: updateNpmImpl,
306
+ installedDirectory: updateInstalledDirectory,
307
+ runtimeDirectory,
308
+ }),
309
+ );
310
+ return 0;
311
+ }
312
+ releaseRuntime = await acquireRuntime(runtimeDirectory);
271
313
  if (options.environment && !Object.hasOwn(ORIGINS, options.environment)) {
272
314
  fail('invalid_arguments', 'Environment must be production or development.');
273
315
  }
@@ -341,10 +383,16 @@ export async function main(
341
383
  data = await new AgentProfiles(client).restrict(await readCommandFile(options.file));
342
384
  } else if (command === 'profiles select') {
343
385
  data = await new AgentProfiles(client).select({ profileId: options.profile });
386
+ } else if (command === 'protocols preview') {
387
+ data = await previewProtocol(client, await readCommandFile(options.file));
388
+ } else if (command === 'runs event') {
389
+ data = await reportRunEvent(client, await readCommandFile(options.file), {
390
+ prepareOnly: options.prepare === true,
391
+ });
344
392
  } else if (command === 'workflow show') {
345
393
  data = workflow({ topic: options.topic });
346
394
  } else if (command === 'commands describe') {
347
- data = describeCommands();
395
+ data = options.kind ? commandHelp({ kind: options.kind }) : describeCommands();
348
396
  } else if (command === 'commands prepare') {
349
397
  data = await new CommandJournal(client).prepare(await readCommandFile(options.file));
350
398
  } else if (command === 'commands execute') {
@@ -499,13 +547,30 @@ export async function main(
499
547
  if (signal?.aborted) {
500
548
  close();
501
549
  }
550
+ // The stdio server outlives main(). Keep its lease until process exit;
551
+ // replacing files while a host could call a tool is unsafe.
552
+ releaseRuntime = undefined;
502
553
  return 0; // stdout belongs exclusively to JSON-RPC.
503
554
  }
504
555
  emit(data);
556
+ await maybeNotifyUpdate({
557
+ command,
558
+ options,
559
+ isTTY,
560
+ stdout,
561
+ stderr,
562
+ signal,
563
+ fetchImpl: updateFetchImpl,
564
+ cacheDirectory: updateCacheDirectory,
565
+ env: updateEnvironment,
566
+ });
505
567
  return 0;
506
568
  } catch (error) {
507
569
  const safe = safeError(error);
508
570
  stderr.write(JSON.stringify({ formatVersion: 1, ok: false, error: safe.toJSON() }) + '\n');
509
571
  return exitCode(safe);
572
+ } finally {
573
+ // Cleanup cannot turn a confirmed remote receipt into a reported failure.
574
+ await releaseRuntime?.().catch(() => {});
510
575
  }
511
576
  }
package/src/client.mjs CHANGED
@@ -1,3 +1,4 @@
1
+ import { retryAt, requireRetryReady } from './recovery.mjs';
1
2
  import { fail } from './errors.mjs';
2
3
  import { createHash } from 'node:crypto';
3
4
  import { ConditionalReadCache } from './read-cache.mjs';
@@ -80,6 +81,7 @@ export class AgentClient {
80
81
  async authorizedSession() {
81
82
  return this.store.locked(async () => {
82
83
  const session = await this.session();
84
+ requireRetryReady(session.retryAt);
83
85
  if (session.refreshPending) {
84
86
  fail('reauthentication_required', 'The previous renewal outcome is unknown.', {
85
87
  remediation:
@@ -112,6 +114,10 @@ export class AgentClient {
112
114
  : {}),
113
115
  });
114
116
  } catch (error) {
117
+ if (error?.retryable && error?.details?.execution === 'not_started') {
118
+ await this.store.write({ ...session, retryAt: retryAt(error), refreshPending: false });
119
+ throw error;
120
+ }
115
121
  // These two server outcomes happen before token consumption/rotation.
116
122
  // Every other refusal or lost reply retains the uncertainty marker.
117
123
  if (
@@ -139,6 +145,7 @@ export class AgentClient {
139
145
  async selectProfile(selection) {
140
146
  return this.store.locked(async () => {
141
147
  const session = await this.session();
148
+ requireRetryReady(session.retryAt);
142
149
  if (session.refreshPending) {
143
150
  fail('reauthentication_required', 'The previous renewal outcome is unknown.', {
144
151
  remediation: