@agentrq/agentrq-ws 0.15.7 → 0.16.1
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 +3 -3
- package/package.json +1 -1
- package/src/cli.js +4 -1
- package/src/commands.js +29 -6
package/README.md
CHANGED
|
@@ -50,12 +50,12 @@ Node 20.6 or newer.
|
|
|
50
50
|
| `task help [action]` | The server's help for its `task` tool: every action, or one action's payload |
|
|
51
51
|
| `reply <taskId> <text>` | Send a message to a task |
|
|
52
52
|
| `attachment get <id> --task <taskId>` | Download an attachment to a file |
|
|
53
|
-
| `memory load [name]` | Read a workspace memory (defaults to the index) |
|
|
54
|
-
| `memory save [name] --content
|
|
53
|
+
| `memory load [name]` | Read a workspace memory (defaults to the index); its version goes to stderr |
|
|
54
|
+
| `memory save [name] --content … [--version N]` | Replace a workspace memory; `--version` is the one `memory load` printed, required to change one that exists |
|
|
55
55
|
| `memory delete [name]` | Delete a workspace memory |
|
|
56
56
|
| `skill search [q]` | Find the skills this workspace can use, by name or description; `--limit`/`--offset` page |
|
|
57
57
|
| `skill load <uri>` | Read a skill file (`skill://<name>` reads its `SKILL.md`) |
|
|
58
|
-
| `skill save <uri> --content
|
|
58
|
+
| `skill save <uri> --content … [--version N] [--team \| --no-team] [--team-workspace NAME]` | Replace a file of one of this workspace's skills; a skill shared with your team needs the version `skill load` printed. In a workspace shared into a team workspace, a new skill goes to the team's: `--no-team` keeps it yours, `--team-workspace` picks one of several |
|
|
59
59
|
| `skill delete <uri>` | Take a skill out of this workspace (`skill://<name>`), deleting it when no other workspace uses it, or delete one of its files |
|
|
60
60
|
| `pano save [id --version N] --title … --markdown …` | Create a Pano doc, or replace one, and print its id and version; replacing needs the `--version` you read and is refused if the doc changed since; `--file` sends a file the markdown links, `--ttl-days` and `--color` set its life and post-it |
|
|
61
61
|
| `pano edit <id> --version N …` | Change part of a doc without resending it: `--replace TEXT --with TEXT` (the text must occur once), `--append TEXT`, or `--ops` as a JSON array; the ops apply all or none. Prints the id and new version |
|
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -100,7 +100,9 @@ export async function run({
|
|
|
100
100
|
write(stdout, commandHelp(command))
|
|
101
101
|
return 0
|
|
102
102
|
}
|
|
103
|
-
|
|
103
|
+
// A command's own --version (pano save's, memory save's) is a string:
|
|
104
|
+
// only the global flag is true.
|
|
105
|
+
if (values.version === true) {
|
|
104
106
|
write(stdout, VERSION)
|
|
105
107
|
return 0
|
|
106
108
|
}
|
|
@@ -120,6 +122,7 @@ export async function run({
|
|
|
120
122
|
} else if (outcome.text) {
|
|
121
123
|
write(stdout, outcome.text)
|
|
122
124
|
}
|
|
125
|
+
if (outcome.note && !values.json) write(stderr, outcome.note)
|
|
123
126
|
return 0
|
|
124
127
|
} catch (err) {
|
|
125
128
|
if (err instanceof UserError || err instanceof ServerError) {
|
package/src/commands.js
CHANGED
|
@@ -194,6 +194,11 @@ async function panoEditOps(ctx) {
|
|
|
194
194
|
/** The doc's version, as a flag: required to change a doc that exists. */
|
|
195
195
|
function panoVersion(value) {
|
|
196
196
|
if (value === undefined) throw new UserError('--version is required to change a doc: the version you read (pano read prints it)')
|
|
197
|
+
return wholeVersion(value)
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/** A --version flag's value: a whole number, 1 or more. */
|
|
201
|
+
function wholeVersion(value) {
|
|
197
202
|
const version = Number(value)
|
|
198
203
|
if (!Number.isInteger(version) || version < 1) throw new UserError('--version must be a whole number, 1 or more')
|
|
199
204
|
return version
|
|
@@ -351,23 +356,30 @@ export const COMMANDS = [
|
|
|
351
356
|
},
|
|
352
357
|
{
|
|
353
358
|
path: ['memory', 'load'],
|
|
354
|
-
summary: 'Read a workspace memory (defaults to the index)',
|
|
359
|
+
summary: 'Read a workspace memory (defaults to the index); its version goes to stderr',
|
|
355
360
|
usage: 'agentrq-ws memory load [name]',
|
|
356
361
|
async run(ctx) {
|
|
357
|
-
|
|
362
|
+
const outcome = await act(ctx, 'memory', 'load', { name: ctx.positionals[0] }, 'loadMemory')
|
|
363
|
+
// The server sends the memory, then its version in a block of its own:
|
|
364
|
+
// the version goes to stderr, so `memory load > notes.md` is the memory.
|
|
365
|
+
const blocks = (outcome.result?.content || []).filter((block) => typeof block?.text === 'string')
|
|
366
|
+
if (blocks.length < 2) return outcome
|
|
367
|
+
return { ...outcome, text: blocks[0].text, note: blocks.slice(1).map((block) => block.text).join('\n') }
|
|
358
368
|
},
|
|
359
369
|
},
|
|
360
370
|
{
|
|
361
371
|
path: ['memory', 'save'],
|
|
362
372
|
summary: 'Replace a workspace memory',
|
|
363
|
-
usage: 'agentrq-ws memory save [name] --content TEXT|@file|-',
|
|
373
|
+
usage: 'agentrq-ws memory save [name] --content TEXT|@file|- [--version N]',
|
|
364
374
|
options: {
|
|
365
375
|
content: { type: 'string', short: 'C', description: 'The full new content (@file or - for stdin)' },
|
|
376
|
+
version: { type: 'string', short: 'v', description: 'The version memory load printed; required to change a memory that exists, refused if it changed since' },
|
|
366
377
|
},
|
|
367
378
|
async run(ctx) {
|
|
368
379
|
if (ctx.values.content === undefined) throw new UserError('--content is required (use @file or - to read from stdin)')
|
|
369
380
|
const content = await resolveText(ctx.values.content, { stdin: ctx.stdin, what: 'the memory content' })
|
|
370
|
-
|
|
381
|
+
const version = ctx.values.version === undefined ? undefined : wholeVersion(ctx.values.version)
|
|
382
|
+
return act(ctx, 'memory', 'save', { name: ctx.positionals[0], content, version }, 'saveMemory')
|
|
371
383
|
},
|
|
372
384
|
},
|
|
373
385
|
{
|
|
@@ -403,15 +415,26 @@ export const COMMANDS = [
|
|
|
403
415
|
{
|
|
404
416
|
path: ['skill', 'save'],
|
|
405
417
|
summary: 'Replace a file of one of this workspace\'s skills',
|
|
406
|
-
usage: 'agentrq-ws skill save <uri> --content TEXT|@file|-',
|
|
418
|
+
usage: 'agentrq-ws skill save <uri> --content TEXT|@file|- [--version N] [--team | --no-team] [--team-workspace NAME]',
|
|
407
419
|
options: {
|
|
408
420
|
content: { type: 'string', short: 'C', description: 'The full new content (@file or - for stdin)' },
|
|
421
|
+
version: { type: 'string', short: 'v', description: 'The version skill load printed; required to replace a file of a skill shared with your team, refused if it changed since' },
|
|
422
|
+
team: { type: 'boolean', description: 'Put a new skill in the team workspace this workspace is shared into (the default there)' },
|
|
423
|
+
'no-team': { type: 'boolean', description: 'Keep a new skill in your own account rather than the team workspace this workspace is shared into' },
|
|
424
|
+
'team-workspace': { type: 'string', description: 'The team workspace a new skill goes to, when this workspace is shared into more than one' },
|
|
409
425
|
},
|
|
410
426
|
async run(ctx) {
|
|
411
427
|
const uri = requirePositional(ctx.positionals, 0, 'uri')
|
|
412
428
|
if (ctx.values.content === undefined) throw new UserError('--content is required (use @file or - to read from stdin)')
|
|
413
429
|
const content = await resolveText(ctx.values.content, { stdin: ctx.stdin, what: 'the skill file' })
|
|
414
|
-
|
|
430
|
+
const version = ctx.values.version === undefined ? undefined : wholeVersion(ctx.values.version)
|
|
431
|
+
const args = { uri, content, version }
|
|
432
|
+
if (ctx.values.team && ctx.values['no-team']) throw new UserError('--team and --no-team cannot be used together')
|
|
433
|
+
if (ctx.values['no-team'] && ctx.values['team-workspace'] !== undefined) throw new UserError('--no-team and --team-workspace cannot be used together')
|
|
434
|
+
if (ctx.values.team) args.team = true
|
|
435
|
+
if (ctx.values['no-team']) args.team = false
|
|
436
|
+
if (ctx.values['team-workspace'] !== undefined) args.teamWorkspace = ctx.values['team-workspace']
|
|
437
|
+
return act(ctx, 'skills', 'save', args, 'saveSkill')
|
|
415
438
|
},
|
|
416
439
|
},
|
|
417
440
|
{
|