@skillcdn/console 0.6.3 → 0.6.4
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 +6 -6
- package/dist/agent-page.d.ts.map +1 -1
- package/dist/agent-page.js +7 -3
- package/dist/agent-page.js.map +1 -1
- package/dist/api.d.ts +5 -4
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +5 -4
- package/dist/api.js.map +1 -1
- package/dist/cli/cli.d.ts.map +1 -1
- package/dist/cli/cli.js +660 -138
- package/dist/cli/cli.js.map +1 -1
- package/dist/cli/format.d.ts +32 -4
- package/dist/cli/format.d.ts.map +1 -1
- package/dist/cli/format.js +125 -4
- package/dist/cli/format.js.map +1 -1
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +91 -29
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/pack.d.ts +11 -10
- package/dist/cli/pack.d.ts.map +1 -1
- package/dist/cli/pack.js +27 -41
- package/dist/cli/pack.js.map +1 -1
- package/dist/cli/plugin-cli.d.ts.map +1 -1
- package/dist/cli/plugin-cli.js +8 -5
- package/dist/cli/plugin-cli.js.map +1 -1
- package/dist/cli/runner-files.d.ts.map +1 -1
- package/dist/cli/runner-files.js +15 -0
- package/dist/cli/runner-files.js.map +1 -1
- package/dist/cli/skill-path.d.ts +11 -0
- package/dist/cli/skill-path.d.ts.map +1 -0
- package/dist/cli/skill-path.js +44 -0
- package/dist/cli/skill-path.js.map +1 -0
- package/dist/client.d.ts +17 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +10 -1
- package/dist/client.js.map +1 -1
- package/dist/components/agent-page.d.ts +67 -5
- package/dist/components/agent-page.d.ts.map +1 -1
- package/dist/components/agent-page.js +161 -14
- package/dist/components/agent-page.js.map +1 -1
- package/dist/components/agents.d.ts +3 -4
- package/dist/components/agents.d.ts.map +1 -1
- package/dist/components/agents.js +7 -6
- package/dist/components/agents.js.map +1 -1
- package/dist/components/people.d.ts.map +1 -1
- package/dist/components/people.js +7 -2
- package/dist/components/people.js.map +1 -1
- package/dist/components/picker.d.ts +16 -0
- package/dist/components/picker.d.ts.map +1 -1
- package/dist/components/picker.js +69 -4
- package/dist/components/picker.js.map +1 -1
- package/dist/console.css +40 -0
- package/dist/console.d.ts.map +1 -1
- package/dist/console.js +1 -1
- package/dist/console.js.map +1 -1
- package/dist/i18n/en.d.ts +19 -5
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +26 -12
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/ko.d.ts.map +1 -1
- package/dist/i18n/ko.js +22 -10
- package/dist/i18n/ko.js.map +1 -1
- package/dist/limits.d.ts +16 -0
- package/dist/limits.d.ts.map +1 -1
- package/dist/limits.js +16 -0
- package/dist/limits.js.map +1 -1
- package/dist/onboarding.d.ts +18 -6
- package/dist/onboarding.d.ts.map +1 -1
- package/dist/onboarding.js +42 -7
- package/dist/onboarding.js.map +1 -1
- package/dist/plugin/args.d.ts +24 -2
- package/dist/plugin/args.d.ts.map +1 -1
- package/dist/plugin/args.js +20 -2
- package/dist/plugin/args.js.map +1 -1
- package/dist/plugin/define.d.ts.map +1 -1
- package/dist/plugin/define.js +12 -3
- package/dist/plugin/define.js.map +1 -1
- package/dist/plugin/rest-schemas.d.ts +2 -0
- package/dist/plugin/rest-schemas.d.ts.map +1 -1
- package/dist/plugin/rest-schemas.js +1 -0
- package/dist/plugin/rest-schemas.js.map +1 -1
- package/dist/routes.d.ts +2 -0
- package/dist/routes.d.ts.map +1 -1
- package/dist/routes.js +2 -0
- package/dist/routes.js.map +1 -1
- package/dist/rules.d.ts +4 -1
- package/dist/rules.d.ts.map +1 -1
- package/dist/rules.js +5 -2
- package/dist/rules.js.map +1 -1
- package/dist/runner/claude.d.ts.map +1 -1
- package/dist/runner/claude.js +48 -0
- package/dist/runner/claude.js.map +1 -1
- package/dist/runner/codex.d.ts.map +1 -1
- package/dist/runner/codex.js +4 -1
- package/dist/runner/codex.js.map +1 -1
- package/dist/runner/desk.d.ts.map +1 -1
- package/dist/runner/desk.js +5 -4
- package/dist/runner/desk.js.map +1 -1
- package/dist/runner/runner.d.ts +16 -0
- package/dist/runner/runner.d.ts.map +1 -1
- package/dist/runner/runner.js +157 -8
- package/dist/runner/runner.js.map +1 -1
- package/dist/runner/slack.d.ts.map +1 -1
- package/dist/runner/slack.js +14 -3
- package/dist/runner/slack.js.map +1 -1
- package/dist/runner/types.d.ts +19 -0
- package/dist/runner/types.d.ts.map +1 -1
- package/dist/runner/types.js.map +1 -1
- package/dist/schemas.d.ts +475 -5
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +117 -12
- package/dist/schemas.js.map +1 -1
- package/dist/secret-file.d.ts +21 -0
- package/dist/secret-file.d.ts.map +1 -0
- package/dist/secret-file.js +59 -0
- package/dist/secret-file.js.map +1 -0
- package/dist/services.d.ts.map +1 -1
- package/dist/services.js +3 -2
- package/dist/services.js.map +1 -1
- package/dist/setup-guide.d.ts +2 -2
- package/dist/setup-guide.d.ts.map +1 -1
- package/dist/setup-guide.js +6 -5
- package/dist/setup-guide.js.map +1 -1
- package/dist/vocabulary.d.ts +10 -2
- package/dist/vocabulary.d.ts.map +1 -1
- package/dist/vocabulary.js +9 -2
- package/dist/vocabulary.js.map +1 -1
- package/docs/specs/cli.md +22 -16
- package/docs/specs/plugins.md +5 -4
- package/docs/specs/rest.md +24 -12
- package/docs/specs/runner.md +19 -12
- package/docs/start.md +4 -3
- package/package.json +3 -3
- package/skills/building-a-plugin/SKILL.md +2 -2
- package/skills/keeping-the-pack/SKILL.md +87 -0
- package/skills/planning-the-board/SKILL.md +6 -6
- package/skills/planning-the-board/references/a-task.md +1 -1
- package/skills/planning-the-board/references/setting-up.md +9 -5
- package/skills/running-an-agent/SKILL.md +15 -14
- package/skills/running-an-agent/references/preparing-the-machine.md +3 -2
- package/skills/running-an-agent/references/several-tasks.md +8 -2
- package/skills/running-an-agent/references/slack-app.md +10 -4
- package/skills/running-an-agent/references/the-account-and-the-invitation.md +1 -1
- package/skills/running-an-agent/references/what-was-not-seen-run-yet.md +3 -1
- package/skills/running-an-agent/references/when-the-agent-could-not-go-on.md +3 -3
- package/skills/running-an-agent/references/your-first-task.md +4 -3
- package/skills/working-the-board/SKILL.md +4 -4
- package/skills/working-the-board/references/terms.md +3 -1
- package/skills/working-the-board/references/the-pack.md +12 -5
- package/src/agent-page.tsx +19 -3
- package/src/api.ts +27 -0
- package/src/cli/cli.ts +847 -192
- package/src/cli/format.ts +158 -4
- package/src/cli/help.ts +102 -28
- package/src/cli/pack.ts +49 -58
- package/src/cli/plugin-cli.ts +8 -5
- package/src/cli/runner-files.ts +17 -0
- package/src/cli/skill-path.ts +51 -0
- package/src/client.ts +50 -0
- package/src/components/agent-page.tsx +309 -30
- package/src/components/agents.tsx +7 -23
- package/src/components/people.tsx +7 -3
- package/src/components/picker.tsx +79 -5
- package/src/console.tsx +0 -1
- package/src/i18n/en.ts +28 -13
- package/src/i18n/ko.ts +24 -10
- package/src/limits.ts +16 -0
- package/src/onboarding.ts +60 -21
- package/src/plugin/args.ts +29 -3
- package/src/plugin/define.ts +18 -3
- package/src/plugin/rest-schemas.ts +3 -0
- package/src/routes.ts +2 -0
- package/src/rules.ts +5 -2
- package/src/runner/claude.ts +53 -0
- package/src/runner/codex.ts +4 -1
- package/src/runner/desk.ts +5 -4
- package/src/runner/runner.ts +199 -9
- package/src/runner/slack.ts +18 -7
- package/src/runner/types.ts +16 -0
- package/src/schemas.ts +148 -10
- package/src/secret-file.ts +76 -0
- package/src/services.ts +3 -2
- package/src/setup-guide.ts +6 -5
- package/src/styles/README.md +1 -1
- package/src/styles/pages/agents.css +40 -0
- package/src/vocabulary.ts +12 -2
- package/dist/cli/command-words.d.ts +0 -20
- package/dist/cli/command-words.d.ts.map +0 -1
- package/dist/cli/command-words.js +0 -51
- package/dist/cli/command-words.js.map +0 -1
- package/src/cli/command-words.ts +0 -56
package/src/cli/pack.ts
CHANGED
|
@@ -7,23 +7,20 @@ import {
|
|
|
7
7
|
type Pack,
|
|
8
8
|
PackError,
|
|
9
9
|
type RowsPage,
|
|
10
|
+
shellLine,
|
|
10
11
|
} from "@skillcdn/cli";
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
type RestSkill as RestSkillPage,
|
|
21
|
-
type ToolWords,
|
|
22
|
-
} from "@skillcdn/core";
|
|
12
|
+
import { isReadmePath, type ToolWords } from "@skillcdn/core";
|
|
13
|
+
import { parseAddress, parseRepoPath } from "@skillcdn/core/address";
|
|
14
|
+
import type {
|
|
15
|
+
RestBrowse,
|
|
16
|
+
RestFile,
|
|
17
|
+
RestFind,
|
|
18
|
+
RestMount,
|
|
19
|
+
RestSkill as RestSkillPage,
|
|
20
|
+
} from "@skillcdn/core/rest";
|
|
23
21
|
import type { PackClient } from "../client.js";
|
|
24
22
|
import type { RestSkills } from "../schemas.js";
|
|
25
23
|
import type { SkillsStatus } from "../vocabulary.js";
|
|
26
|
-
import { commandLine, NO_LINE_TO_RUN } from "./command-words.js";
|
|
27
24
|
|
|
28
25
|
// The pack of the project, as the command prints it (ADR-0028, ADR-0031, ADR-0124): the console
|
|
29
26
|
// answers what the pack's REST API answered, in the shapes of @skillcdn/core, and the command
|
|
@@ -33,6 +30,44 @@ import { commandLine, NO_LINE_TO_RUN } from "./command-words.js";
|
|
|
33
30
|
// comes with its next version. What is here is the console's own: the pack made of the console's
|
|
34
31
|
// answers, the lines around a listing, and the words of a pack the console could not read,
|
|
35
32
|
// which is a project's or the organization's and whose token is the console's to hold.
|
|
33
|
+
//
|
|
34
|
+
// This module is the one place of the command that imports @skillcdn/cli and the main entry
|
|
35
|
+
// point of @skillcdn/core, and the command loads it only where a pack is read (ADR-0179):
|
|
36
|
+
// importing either loads the whole of the main repository's library, a quarter of a second
|
|
37
|
+
// every other command would pay for nothing. What the command takes of the library for a read
|
|
38
|
+
// it takes from here.
|
|
39
|
+
|
|
40
|
+
export {
|
|
41
|
+
PackError,
|
|
42
|
+
ReadMisuse,
|
|
43
|
+
readNumber,
|
|
44
|
+
readPack,
|
|
45
|
+
wroteLine,
|
|
46
|
+
} from "@skillcdn/cli";
|
|
47
|
+
export {
|
|
48
|
+
BROWSE_MAX_LIMIT,
|
|
49
|
+
FIND_MAX_LIMIT,
|
|
50
|
+
READ_FILE_MAX_LIMIT,
|
|
51
|
+
utf8Length,
|
|
52
|
+
} from "@skillcdn/core";
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Words as one line printed for a person or an agent to run, after `command`, the command's own
|
|
56
|
+
* words: each spelled by the skillcdn command's own rule (`shellLine` of @skillcdn/cli), so that
|
|
57
|
+
* bash, zsh and PowerShell all take it whole as it is. Nothing where one of them has no such
|
|
58
|
+
* spelling: what to run is then said in a sentence, and no line is printed.
|
|
59
|
+
*/
|
|
60
|
+
export function commandLine(command: string, words: readonly string[]): string | undefined {
|
|
61
|
+
const spelled = shellLine(words);
|
|
62
|
+
if (spelled === undefined) {
|
|
63
|
+
return undefined;
|
|
64
|
+
}
|
|
65
|
+
return spelled.length === 0 ? command : `${command} ${spelled}`;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** Why a line is not printed for a person or an agent to run, said in its place. */
|
|
69
|
+
export const NO_LINE_TO_RUN =
|
|
70
|
+
"No line is printed to run: a word of it has no one spelling that bash, zsh and PowerShell all take whole.";
|
|
36
71
|
|
|
37
72
|
/** How the results name the four reads of a pack read with `skills` and `skill`, so that an agent is told the command and not a tool. */
|
|
38
73
|
export const packWords = (skills: string, skill: string): ToolWords => ({
|
|
@@ -255,7 +290,7 @@ function listingStart(cursor: string | undefined, commit: string, count: number)
|
|
|
255
290
|
* A document's outline with the reads of its tables and its code blocks named as commands
|
|
256
291
|
* (ADR-0100): where the console said an address of its own for one, the command that reads it,
|
|
257
292
|
* `command` being the one the pack is read with, so that an agent is told what to run. Where the
|
|
258
|
-
* path has no spelling
|
|
293
|
+
* path has no spelling every shell takes whole, what to run is said in words, with why.
|
|
259
294
|
*/
|
|
260
295
|
function withDataCommands(read: Ready<RestBrowse>, command: string): Ready<RestBrowse> {
|
|
261
296
|
const outline = read.outline;
|
|
@@ -454,50 +489,6 @@ export function skillsAround(
|
|
|
454
489
|
};
|
|
455
490
|
}
|
|
456
491
|
|
|
457
|
-
/**
|
|
458
|
-
* The `SKILL.md` a path names: the path itself where it names one, else the one in the folder
|
|
459
|
-
* it names, since a skill is its folder and a listing cut short shows the folder alone; the
|
|
460
|
-
* root's own for the dot, as the root is everywhere.
|
|
461
|
-
*/
|
|
462
|
-
function skillFileOf(given: string): string {
|
|
463
|
-
const path = given.replace(/\/+$/, "");
|
|
464
|
-
if (path === "" || path === ".") {
|
|
465
|
-
return "SKILL.md";
|
|
466
|
-
}
|
|
467
|
-
return path === "SKILL.md" || path.endsWith("/SKILL.md") ? path : `${path}/SKILL.md`;
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
/**
|
|
471
|
-
* A skill's path as given, or taken out of the URI the listing names it by
|
|
472
|
-
* (`skill://<host>/<owner>/<name>/<path>`); a URI of another pack would read this pack's skill
|
|
473
|
-
* at the same path, or nothing, so it is said instead.
|
|
474
|
-
*/
|
|
475
|
-
export function skillPathIn(
|
|
476
|
-
given: string,
|
|
477
|
-
packAddress: string | null,
|
|
478
|
-
): { readonly path: string } | { readonly error: string } {
|
|
479
|
-
const uri = parseSkillUri(given);
|
|
480
|
-
if (uri === undefined) {
|
|
481
|
-
return given.startsWith("skill://")
|
|
482
|
-
? {
|
|
483
|
-
error: `Not a skill's URI the console knows: ${given}. Say the path of its SKILL.md from the repository's root, or the URI console skills lists.`,
|
|
484
|
-
}
|
|
485
|
-
: { path: skillFileOf(given) };
|
|
486
|
-
}
|
|
487
|
-
const pack = packAddress === null ? undefined : parseAddress(packAddress);
|
|
488
|
-
if (
|
|
489
|
-
pack?.ok === true &&
|
|
490
|
-
(uri.address.host !== pack.value.host ||
|
|
491
|
-
uri.address.owner !== pack.value.owner ||
|
|
492
|
-
uri.address.repo !== pack.value.repo)
|
|
493
|
-
) {
|
|
494
|
-
return {
|
|
495
|
-
error: `That URI is of another pack, /${uri.address.host}/${uri.address.owner}/${uri.address.repo}; this project's pack is at ${packAddress}. Say the path of the SKILL.md, or a URI console skills lists.`,
|
|
496
|
-
};
|
|
497
|
-
}
|
|
498
|
-
return { path: uri.path };
|
|
499
|
-
}
|
|
500
|
-
|
|
501
492
|
/** Whether a read of data held nothing, by what the read says it holds: no table, or no code block. */
|
|
502
493
|
export const holdsNothing = (holds: string | undefined): boolean =>
|
|
503
494
|
holds !== undefined && /(^| )0 (tables|code blocks)$/.test(holds);
|
package/src/cli/plugin-cli.ts
CHANGED
|
@@ -6,7 +6,6 @@ import { parseArgs } from "node:util";
|
|
|
6
6
|
import type { ServerLoad } from "../plugin/load.js";
|
|
7
7
|
import { isPluginKey, RESERVED_PLUGIN_KEYS } from "../plugin/manifest.js";
|
|
8
8
|
import { lineRangeFrom, versionOfDependency } from "../plugin/semver.js";
|
|
9
|
-
import { commandWord, NO_LINE_TO_RUN } from "./command-words.js";
|
|
10
9
|
import { checkPlugin, MAX_CHECKED_FILE_BYTES, readConsoleClasses } from "./plugin-check.js";
|
|
11
10
|
import { LANGUAGE_TAG, nameFromKey, PACKAGE_NAME, writePluginFromTemplate } from "./plugin-init.js";
|
|
12
11
|
|
|
@@ -204,11 +203,15 @@ async function init(args: readonly string[], io: PluginCliIo): Promise<number> {
|
|
|
204
203
|
languages,
|
|
205
204
|
});
|
|
206
205
|
io.stdout(`Wrote the plugin ${key} into ${target}: ${written.length} files.\n`);
|
|
207
|
-
// The folder as
|
|
208
|
-
//
|
|
209
|
-
|
|
206
|
+
// The folder as every shell takes it whole, by the skillcdn command's own rule, whose
|
|
207
|
+
// library is loaded here and by nothing else of this command; where it has no such
|
|
208
|
+
// spelling, it is named above, and no line is printed to run. The plugin is written by
|
|
209
|
+
// then: where the library does not load, that is said all the same, the folder by name.
|
|
210
|
+
const reads = await import("./pack.js").catch(() => undefined);
|
|
211
|
+
const into = reads?.commandLine("", [dir])?.trim();
|
|
212
|
+
const noLine = reads === undefined || into !== undefined ? "" : ` ${reads.NO_LINE_TO_RUN}`;
|
|
210
213
|
io.stdout(
|
|
211
|
-
`Next: ${into === undefined ? "go into that folder" : `cd ${into}`}, install the dependencies (npm install), build (npm run build), run the tests (npm test), and check it as a console would (npm run check). The contract is docs/specs/plugins.md in node_modules/@skillcdn/console/.${
|
|
214
|
+
`Next: ${into === undefined ? "go into that folder" : `cd ${into}`}, install the dependencies (npm install), build (npm run build), run the tests (npm test), and check it as a console would (npm run check). The contract is docs/specs/plugins.md in node_modules/@skillcdn/console/.${noLine}\n`,
|
|
212
215
|
);
|
|
213
216
|
return PLUGIN_EXIT.ok;
|
|
214
217
|
} catch (error) {
|
package/src/cli/runner-files.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { parseVersion } from "../compat.js";
|
|
1
2
|
import type { KeptBySource, RunnerState } from "../runner/runner.js";
|
|
2
3
|
|
|
3
4
|
// The runner's own files under the desk's `work/`, as `console runner` reads them back and
|
|
@@ -25,6 +26,8 @@ export function runnerStateOf(text: string | undefined): RunnerState | undefined
|
|
|
25
26
|
const limited = "limited" in json ? json.limited : undefined;
|
|
26
27
|
const kept: unknown = "kept" in json ? json.kept : undefined;
|
|
27
28
|
const began: unknown = "began" in json ? json.began : undefined;
|
|
29
|
+
const unknown: unknown = "unknown" in json ? json.unknown : undefined;
|
|
30
|
+
const newer: unknown = "newer" in json ? json.newer : undefined;
|
|
28
31
|
if (typeof delivered !== "number" || !Number.isSafeInteger(delivered) || delivered < 0) {
|
|
29
32
|
return undefined;
|
|
30
33
|
}
|
|
@@ -69,6 +72,20 @@ export function runnerStateOf(text: string | undefined): RunnerState | undefined
|
|
|
69
72
|
// When the conversation kept began (ADR-0166): nothing for a file of before, or a number that
|
|
70
73
|
// is none. One ahead of the machine's clock is the runner's to hold to it, which knows the time.
|
|
71
74
|
...(momentOf(began) === undefined ? {} : { began: momentOf(began) }),
|
|
75
|
+
// The kinds of output a driver had no reading for that a record says already (ADR-0182):
|
|
76
|
+
// each a line of the driver's own words, of printable ASCII, a few dozen at the most.
|
|
77
|
+
...(Array.isArray(unknown)
|
|
78
|
+
? {
|
|
79
|
+
unknown: unknown
|
|
80
|
+
.filter(
|
|
81
|
+
(what): what is string => typeof what === "string" && /^[ -~]{1,80}$/.test(what),
|
|
82
|
+
)
|
|
83
|
+
.slice(0, 32),
|
|
84
|
+
}
|
|
85
|
+
: {}),
|
|
86
|
+
// The console's version the agent was told a newer command exists for (ADR-0182): a version
|
|
87
|
+
// as the package spells one, or nothing.
|
|
88
|
+
...(typeof newer === "string" && parseVersion(newer) !== undefined ? { newer } : {}),
|
|
72
89
|
};
|
|
73
90
|
}
|
|
74
91
|
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { parseAddress, parseSkillUri } from "@skillcdn/core/address";
|
|
2
|
+
|
|
3
|
+
// How a skill of a pack is named on the command line: by the path of its `SKILL.md`, by its
|
|
4
|
+
// folder, or by the URI the pack names it by. Apart from the pack the command prints
|
|
5
|
+
// (`pack.ts`), since a note on a skill names one too and reads no pack: this module takes the
|
|
6
|
+
// address scheme alone of the main repository's library, which loads next to nothing
|
|
7
|
+
// (ADR-0179).
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The `SKILL.md` a path names: the path itself where it names one, else the one in the folder
|
|
11
|
+
* it names, since a skill is its folder and a listing cut short shows the folder alone; the
|
|
12
|
+
* root's own for the dot, as the root is everywhere.
|
|
13
|
+
*/
|
|
14
|
+
function skillFileOf(given: string): string {
|
|
15
|
+
const path = given.replace(/\/+$/, "");
|
|
16
|
+
if (path === "" || path === ".") {
|
|
17
|
+
return "SKILL.md";
|
|
18
|
+
}
|
|
19
|
+
return path === "SKILL.md" || path.endsWith("/SKILL.md") ? path : `${path}/SKILL.md`;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* A skill's path as given, or taken out of the URI the listing names it by
|
|
24
|
+
* (`skill://<host>/<owner>/<name>/<path>`); a URI of another pack would read this pack's skill
|
|
25
|
+
* at the same path, or nothing, so it is said instead.
|
|
26
|
+
*/
|
|
27
|
+
export function skillPathIn(
|
|
28
|
+
given: string,
|
|
29
|
+
packAddress: string | null,
|
|
30
|
+
): { readonly path: string } | { readonly error: string } {
|
|
31
|
+
const uri = parseSkillUri(given);
|
|
32
|
+
if (uri === undefined) {
|
|
33
|
+
return given.startsWith("skill://")
|
|
34
|
+
? {
|
|
35
|
+
error: `Not a skill's URI the console knows: ${given}. Say the path of its SKILL.md from the repository's root, or the URI console skills lists.`,
|
|
36
|
+
}
|
|
37
|
+
: { path: skillFileOf(given) };
|
|
38
|
+
}
|
|
39
|
+
const pack = packAddress === null ? undefined : parseAddress(packAddress);
|
|
40
|
+
if (
|
|
41
|
+
pack?.ok === true &&
|
|
42
|
+
(uri.address.host !== pack.value.host ||
|
|
43
|
+
uri.address.owner !== pack.value.owner ||
|
|
44
|
+
uri.address.repo !== pack.value.repo)
|
|
45
|
+
) {
|
|
46
|
+
return {
|
|
47
|
+
error: `That URI is of another pack, /${uri.address.host}/${uri.address.owner}/${uri.address.repo}; this project's pack is at ${packAddress}. Say the path of the SKILL.md, or a URI console skills lists.`,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
return { path: uri.path };
|
|
51
|
+
}
|
package/src/client.ts
CHANGED
|
@@ -83,6 +83,11 @@ import {
|
|
|
83
83
|
type RestOwnWakes,
|
|
84
84
|
type RestPackConnect,
|
|
85
85
|
type RestPackConnectStarted,
|
|
86
|
+
type RestPackNote,
|
|
87
|
+
type RestPackNoteCloseInput,
|
|
88
|
+
type RestPackNoteInput,
|
|
89
|
+
type RestPackNoteLeft,
|
|
90
|
+
type RestPackNotes,
|
|
86
91
|
type RestPackTokenInput,
|
|
87
92
|
type RestPeople,
|
|
88
93
|
type RestPerson,
|
|
@@ -205,6 +210,9 @@ import {
|
|
|
205
210
|
restOwnWakesSchema,
|
|
206
211
|
restPackConnectSchema,
|
|
207
212
|
restPackConnectStartedSchema,
|
|
213
|
+
restPackNoteLeftSchema,
|
|
214
|
+
restPackNoteSchema,
|
|
215
|
+
restPackNotesSchema,
|
|
208
216
|
restPeopleSchema,
|
|
209
217
|
restPersonSchema,
|
|
210
218
|
restPersonWorkBriefSchema,
|
|
@@ -819,6 +827,25 @@ export interface ConsoleClient {
|
|
|
819
827
|
secretOffers(signal?: AbortSignal): Promise<RestAgentSecretOffers>;
|
|
820
828
|
takeSecretOffer(id: string, input?: RestAgentSecretOfferTakeInput): Promise<RestAgentSecret>;
|
|
821
829
|
leaveSecretOffer(id: string): Promise<void>;
|
|
830
|
+
/**
|
|
831
|
+
* The notes on the pack (ADR-0178). One left, by any member, for whoever keeps the pack: on a
|
|
832
|
+
* skill or a page by its path, or with no path for a job no skill fit. The notes the asker
|
|
833
|
+
* reads: everyone's for the keeper and an administrator, their own for anyone else. One
|
|
834
|
+
* closed, with what became of it: by the keeper or an administrator, or by its author, who
|
|
835
|
+
* takes it back.
|
|
836
|
+
*/
|
|
837
|
+
leavePackNote(input: RestPackNoteInput): Promise<RestPackNoteLeft>;
|
|
838
|
+
packNotes(
|
|
839
|
+
query?: {
|
|
840
|
+
readonly state?: "open" | "all" | undefined;
|
|
841
|
+
readonly mine?: boolean | undefined;
|
|
842
|
+
readonly path?: string | undefined;
|
|
843
|
+
readonly limit?: number | undefined;
|
|
844
|
+
readonly offset?: number | undefined;
|
|
845
|
+
},
|
|
846
|
+
signal?: AbortSignal,
|
|
847
|
+
): Promise<RestPackNotes>;
|
|
848
|
+
closePackNote(id: string, input: RestPackNoteCloseInput): Promise<RestPackNote>;
|
|
822
849
|
/** The invitation that leads a machine to an agent account (ADR-0088), as it stands; for a supervisor. */
|
|
823
850
|
agentInvitation(handle: string, signal?: AbortSignal): Promise<RestAgentInvitationState>;
|
|
824
851
|
/** Makes the invitation, in place of the one there was: the code this once, and the command to run with it. */
|
|
@@ -1795,6 +1822,29 @@ export function createClient(options: ClientOptions = {}): ConsoleClient {
|
|
|
1795
1822
|
),
|
|
1796
1823
|
leaveSecretOffer: (id) =>
|
|
1797
1824
|
request("DELETE", `${base}${agentPath("me", "secret-offers", id)}`, undefined, undefined),
|
|
1825
|
+
leavePackNote: (input) =>
|
|
1826
|
+
request("POST", `${base}${REST_ROUTES.packNotes}`, input, restPackNoteLeftSchema),
|
|
1827
|
+
packNotes: (query, signal) =>
|
|
1828
|
+
request(
|
|
1829
|
+
"GET",
|
|
1830
|
+
withQuery(REST_ROUTES.packNotes, {
|
|
1831
|
+
state: query?.state,
|
|
1832
|
+
mine: query?.mine === true ? "true" : undefined,
|
|
1833
|
+
path: query?.path,
|
|
1834
|
+
limit: query?.limit === undefined ? undefined : String(query.limit),
|
|
1835
|
+
offset: query?.offset === undefined ? undefined : String(query.offset),
|
|
1836
|
+
}),
|
|
1837
|
+
undefined,
|
|
1838
|
+
restPackNotesSchema,
|
|
1839
|
+
signal,
|
|
1840
|
+
),
|
|
1841
|
+
closePackNote: (id, input) =>
|
|
1842
|
+
request(
|
|
1843
|
+
"POST",
|
|
1844
|
+
`${base}${REST_ROUTES.packNotes}/${encodeURIComponent(id)}/close`,
|
|
1845
|
+
input,
|
|
1846
|
+
restPackNoteSchema,
|
|
1847
|
+
),
|
|
1798
1848
|
agentSecretAccesses: (handle, query, signal) =>
|
|
1799
1849
|
request(
|
|
1800
1850
|
"GET",
|