@skillcdn/console 0.0.0-stage → 0.1.0

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.
Files changed (128) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +79 -2
  3. package/dist/api.d.ts +7 -0
  4. package/dist/api.d.ts.map +1 -0
  5. package/dist/api.js +11 -0
  6. package/dist/api.js.map +1 -0
  7. package/dist/cli/cli.d.ts +32 -0
  8. package/dist/cli/cli.d.ts.map +1 -0
  9. package/dist/cli/cli.js +553 -0
  10. package/dist/cli/cli.js.map +1 -0
  11. package/dist/cli/credentials.d.ts +16 -0
  12. package/dist/cli/credentials.d.ts.map +1 -0
  13. package/dist/cli/credentials.js +46 -0
  14. package/dist/cli/credentials.js.map +1 -0
  15. package/dist/cli/format.d.ts +16 -0
  16. package/dist/cli/format.d.ts.map +1 -0
  17. package/dist/cli/format.js +151 -0
  18. package/dist/cli/format.js.map +1 -0
  19. package/dist/cli/help.d.ts +16 -0
  20. package/dist/cli/help.d.ts.map +1 -0
  21. package/dist/cli/help.js +180 -0
  22. package/dist/cli/help.js.map +1 -0
  23. package/dist/cli/main.d.ts +3 -0
  24. package/dist/cli/main.d.ts.map +1 -0
  25. package/dist/cli/main.js +25 -0
  26. package/dist/cli/main.js.map +1 -0
  27. package/dist/cli/terminal.d.ts +12 -0
  28. package/dist/cli/terminal.d.ts.map +1 -0
  29. package/dist/cli/terminal.js +68 -0
  30. package/dist/cli/terminal.js.map +1 -0
  31. package/dist/client.d.ts +92 -0
  32. package/dist/client.d.ts.map +1 -0
  33. package/dist/client.js +117 -0
  34. package/dist/client.js.map +1 -0
  35. package/dist/components/board.d.ts +20 -0
  36. package/dist/components/board.d.ts.map +1 -0
  37. package/dist/components/board.js +19 -0
  38. package/dist/components/board.js.map +1 -0
  39. package/dist/components/decision-form.d.ts +13 -0
  40. package/dist/components/decision-form.d.ts.map +1 -0
  41. package/dist/components/decision-form.js +23 -0
  42. package/dist/components/decision-form.js.map +1 -0
  43. package/dist/components/decision-list.d.ts +22 -0
  44. package/dist/components/decision-list.d.ts.map +1 -0
  45. package/dist/components/decision-list.js +28 -0
  46. package/dist/components/decision-list.js.map +1 -0
  47. package/dist/components/event-feed.d.ts +13 -0
  48. package/dist/components/event-feed.d.ts.map +1 -0
  49. package/dist/components/event-feed.js +59 -0
  50. package/dist/components/event-feed.js.map +1 -0
  51. package/dist/components/markdown.d.ts +4 -0
  52. package/dist/components/markdown.d.ts.map +1 -0
  53. package/dist/components/markdown.js +34 -0
  54. package/dist/components/markdown.js.map +1 -0
  55. package/dist/components/people.d.ts +11 -0
  56. package/dist/components/people.d.ts.map +1 -0
  57. package/dist/components/people.js +7 -0
  58. package/dist/components/people.js.map +1 -0
  59. package/dist/components/runs.d.ts +27 -0
  60. package/dist/components/runs.d.ts.map +1 -0
  61. package/dist/components/runs.js +45 -0
  62. package/dist/components/runs.js.map +1 -0
  63. package/dist/components/shell.d.ts +22 -0
  64. package/dist/components/shell.d.ts.map +1 -0
  65. package/dist/components/shell.js +16 -0
  66. package/dist/components/shell.js.map +1 -0
  67. package/dist/components/sign-in.d.ts +11 -0
  68. package/dist/components/sign-in.d.ts.map +1 -0
  69. package/dist/components/sign-in.js +15 -0
  70. package/dist/components/sign-in.js.map +1 -0
  71. package/dist/components/skills.d.ts +7 -0
  72. package/dist/components/skills.d.ts.map +1 -0
  73. package/dist/components/skills.js +26 -0
  74. package/dist/components/skills.js.map +1 -0
  75. package/dist/components/task-form.d.ts +14 -0
  76. package/dist/components/task-form.d.ts.map +1 -0
  77. package/dist/components/task-form.js +34 -0
  78. package/dist/components/task-form.js.map +1 -0
  79. package/dist/components/task-view.d.ts +22 -0
  80. package/dist/components/task-view.d.ts.map +1 -0
  81. package/dist/components/task-view.js +32 -0
  82. package/dist/components/task-view.js.map +1 -0
  83. package/dist/components/tokens.d.ts +26 -0
  84. package/dist/components/tokens.d.ts.map +1 -0
  85. package/dist/components/tokens.js +42 -0
  86. package/dist/components/tokens.js.map +1 -0
  87. package/dist/components/ui.d.ts +61 -0
  88. package/dist/components/ui.d.ts.map +1 -0
  89. package/dist/components/ui.js +109 -0
  90. package/dist/components/ui.js.map +1 -0
  91. package/dist/console.css +1382 -0
  92. package/dist/console.d.ts +44 -0
  93. package/dist/console.d.ts.map +1 -0
  94. package/dist/console.js +181 -0
  95. package/dist/console.js.map +1 -0
  96. package/dist/data.d.ts +41 -0
  97. package/dist/data.d.ts.map +1 -0
  98. package/dist/data.js +208 -0
  99. package/dist/data.js.map +1 -0
  100. package/dist/index.d.ts +19 -0
  101. package/dist/index.d.ts.map +1 -0
  102. package/dist/index.js +23 -0
  103. package/dist/index.js.map +1 -0
  104. package/dist/limits.d.ts +37 -0
  105. package/dist/limits.d.ts.map +1 -0
  106. package/dist/limits.js +40 -0
  107. package/dist/limits.js.map +1 -0
  108. package/dist/router.d.ts +37 -0
  109. package/dist/router.d.ts.map +1 -0
  110. package/dist/router.js +55 -0
  111. package/dist/router.js.map +1 -0
  112. package/dist/routes.d.ts +47 -0
  113. package/dist/routes.d.ts.map +1 -0
  114. package/dist/routes.js +53 -0
  115. package/dist/routes.js.map +1 -0
  116. package/dist/schemas.d.ts +789 -0
  117. package/dist/schemas.d.ts.map +1 -0
  118. package/dist/schemas.js +341 -0
  119. package/dist/schemas.js.map +1 -0
  120. package/dist/text.d.ts +6 -0
  121. package/dist/text.d.ts.map +1 -0
  122. package/dist/text.js +31 -0
  123. package/dist/text.js.map +1 -0
  124. package/dist/vocabulary.d.ts +35 -0
  125. package/dist/vocabulary.d.ts.map +1 -0
  126. package/dist/vocabulary.js +57 -0
  127. package/dist/vocabulary.js.map +1 -0
  128. package/package.json +70 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credentials.js","sourceRoot":"","sources":["../../src/cli/credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CA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AAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;YAClD,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,SAAS,CAAC;YACnB,CAAC;QACH,CAAC;QACD,KAAK,CAAC,IAAI,CAAC,WAAW;YACpB,MAAM,KAAK,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;YACzD,MAAM,SAAS,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;YACpF,mGAAmG;YACnG,MAAM,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;YAChD,OAAO,IAAI,CAAC;QACd,CAAC;QACD,KAAK,CAAC,KAAK;YACT,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QAClC,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { RestArtifact, RestDecision, RestRun, RestSkills, RestTask } from "../schemas.js";
2
+ export declare function formatTaskLine(task: RestTask): string;
3
+ /** One task in full; with the decisions about it and the runs on it, when given. */
4
+ export declare function formatTask(task: RestTask, decisions?: readonly RestDecision[], runs?: readonly RestRun[]): string;
5
+ export declare function formatRunLine(run: RestRun): string;
6
+ export declare function formatRun(run: RestRun): string;
7
+ /** What was handed in: the link, or the file with its size and where its bytes are read. */
8
+ export declare function formatArtifact(artifact: RestArtifact): string;
9
+ /** The organization's skills: where they are, and each with what an agent loads it by. */
10
+ export declare function formatSkills(skills: RestSkills): string;
11
+ export declare function formatDecisionLine(decision: RestDecision): string;
12
+ export declare function formatOptions(decision: RestDecision): string;
13
+ /** The answer, with who gave it; or that there is none yet. */
14
+ export declare function formatAnswer(decision: RestDecision): string;
15
+ export declare function formatDecision(decision: RestDecision): string;
16
+ //# sourceMappingURL=format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/cli/format.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAoB/F,wBAAgB,cAAc,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,CAYrD;AAED,oFAAoF;AACpF,wBAAgB,UAAU,CACxB,IAAI,EAAE,QAAQ,EACd,SAAS,CAAC,EAAE,SAAS,YAAY,EAAE,EACnC,IAAI,CAAC,EAAE,SAAS,OAAO,EAAE,GACxB,MAAM,CA4BR;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAMlD;AAED,wBAAgB,SAAS,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAqB9C;AAED,4FAA4F;AAC5F,wBAAgB,cAAc,CAAC,QAAQ,EAAE,YAAY,GAAG,MAAM,CAM7D;AASD,0FAA0F;AAC1F,wBAAgB,YAAY,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAoBvD;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,YAAY,GAAG,MAAM,CAGjE;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,YAAY,GAAG,MAAM,CAE5D;AAED,+DAA+D;AAC/D,wBAAgB,YAAY,CAAC,QAAQ,EAAE,YAAY,GAAG,MAAM,CAa3D;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,YAAY,GAAG,MAAM,CAU7D"}
@@ -0,0 +1,151 @@
1
+ import { restPath } from "../routes.js";
2
+ // What the command prints: one line per thing in a list, a few lines for one thing in full.
3
+ // Plain text, for an agent to read and a person to skim; ids are given, since the commands take
4
+ // them, and the words are the vocabulary's own, since the options take those.
5
+ const plural = (count, word) => `${count} ${word}${count === 1 ? "" : "s"}`;
6
+ const indent = (text) => text
7
+ .trimEnd()
8
+ .split("\n")
9
+ .map((line) => ` ${line}`)
10
+ .join("\n");
11
+ const asker = (decision) => decision.run === null
12
+ ? decision.raisedBy.login
13
+ : `${decision.run.agent} for ${decision.raisedBy.login}`;
14
+ export function formatTaskLine(task) {
15
+ const notes = [`owner ${task.owner.login}`];
16
+ if (task.assignee !== null) {
17
+ notes.push(`assigned to ${task.assignee.login}`);
18
+ }
19
+ if (task.openDecisions > 0) {
20
+ notes.push(`${plural(task.openDecisions, "decision")} waiting`);
21
+ }
22
+ if (task.openRuns > 0) {
23
+ notes.push("an agent at work");
24
+ }
25
+ return `#${task.number} ${task.state} ${task.priority} ${task.title} (${notes.join("; ")})`;
26
+ }
27
+ /** One task in full; with the decisions about it and the runs on it, when given. */
28
+ export function formatTask(task, decisions, runs) {
29
+ const lines = [
30
+ `#${task.number} ${task.title}`,
31
+ `state: ${task.state} priority: ${task.priority} owner: ${task.owner.login} assignee: ${task.assignee?.login ?? "nobody"}`,
32
+ `id: ${task.id}${task.parentId === null ? "" : ` part of: ${task.parentId}`}`,
33
+ ];
34
+ if (task.links.length > 0) {
35
+ lines.push("links:");
36
+ for (const link of task.links) {
37
+ lines.push(` ${link.label === null ? link.url : `${link.label}: ${link.url}`}`);
38
+ }
39
+ }
40
+ if (task.body.trim().length > 0) {
41
+ lines.push("", task.body.trimEnd());
42
+ }
43
+ if (decisions !== undefined) {
44
+ lines.push("", decisions.length === 0 ? "decisions: none" : "decisions:");
45
+ for (const decision of decisions) {
46
+ lines.push(` ${formatDecisionLine(decision)}`);
47
+ }
48
+ }
49
+ if (runs !== undefined) {
50
+ lines.push("", runs.length === 0 ? "runs: none" : "runs:");
51
+ for (const run of runs) {
52
+ lines.push(` ${formatRunLine(run)}`);
53
+ }
54
+ }
55
+ return lines.join("\n");
56
+ }
57
+ export function formatRunLine(run) {
58
+ const notes = [plural(run.reports.length, "report"), plural(run.artifacts.length, "artifact")];
59
+ if (run.waitingFor !== null) {
60
+ notes.push(`waiting for decision ${run.waitingFor}`);
61
+ }
62
+ return `${run.id} ${run.status} ${run.agent} for ${run.person.login} task #${run.taskNumber} (${notes.join(", ")})`;
63
+ }
64
+ export function formatRun(run) {
65
+ const lines = [
66
+ formatRunLine(run),
67
+ `started: ${run.startedAt}${run.endedAt === null ? "" : ` ended: ${run.endedAt}`}`,
68
+ ];
69
+ if (run.summary !== null) {
70
+ lines.push("", "summary:", indent(run.summary));
71
+ }
72
+ if (run.reports.length > 0) {
73
+ lines.push("", "reports:");
74
+ for (const report of run.reports) {
75
+ lines.push(` [${report.createdAt}]`, indent(report.body));
76
+ }
77
+ }
78
+ if (run.artifacts.length > 0) {
79
+ lines.push("", "artifacts:");
80
+ for (const artifact of run.artifacts) {
81
+ lines.push(` ${formatArtifact(artifact)}`);
82
+ }
83
+ }
84
+ return lines.join("\n");
85
+ }
86
+ /** What was handed in: the link, or the file with its size and where its bytes are read. */
87
+ export function formatArtifact(artifact) {
88
+ const what = artifact.file === null
89
+ ? (artifact.url ?? "")
90
+ : `${artifact.file.name} (${artifact.file.size} bytes, ${artifact.file.contentType}; read at ${restPath("files", artifact.id)})`;
91
+ return artifact.label === null ? what : `${artifact.label}: ${what}`;
92
+ }
93
+ const SKILLS_WORDS = {
94
+ indexing: "SkillCDN is still indexing the repository; ask again in a moment.",
95
+ failed: "SkillCDN could not index the repository.",
96
+ not_found: "SkillCDN does not serve this address to the console.",
97
+ unavailable: "SkillCDN could not be reached; ask again later.",
98
+ };
99
+ /** The organization's skills: where they are, and each with what an agent loads it by. */
100
+ export function formatSkills(skills) {
101
+ if (skills.status === "none" || skills.address === null) {
102
+ return "No skills address is configured on this console.";
103
+ }
104
+ const head = `skills at ${skills.address}, served by ${skills.source}: ${skills.status}`;
105
+ if (skills.status !== "ready") {
106
+ return `${head}\n${SKILLS_WORDS[skills.status]}`;
107
+ }
108
+ if (skills.items.length === 0) {
109
+ return `${head}\nNo skills at this address.`;
110
+ }
111
+ const lines = [head];
112
+ for (const skill of skills.items) {
113
+ lines.push(`${skill.name} ${skill.description}`, ` ${skill.uri ?? skill.path}`);
114
+ }
115
+ lines.push("", "Load a skill by its URI through your SkillCDN connection. --json adds the page of each, for a person.");
116
+ return lines.join("\n");
117
+ }
118
+ export function formatDecisionLine(decision) {
119
+ const state = decision.answer === null ? "waiting" : `answered ${decision.answer.option}`;
120
+ return `${decision.id} ${state} ${decision.question} (asked by ${asker(decision)})`;
121
+ }
122
+ export function formatOptions(decision) {
123
+ return decision.options.map((option) => ` ${option.id}) ${option.label}`).join("\n");
124
+ }
125
+ /** The answer, with who gave it; or that there is none yet. */
126
+ export function formatAnswer(decision) {
127
+ const { answer } = decision;
128
+ if (answer === null) {
129
+ return "waits for a person.";
130
+ }
131
+ const label = decision.options.find((option) => option.id === answer.option)?.label;
132
+ const lines = [
133
+ `Answered: ${answer.option}) ${label ?? answer.option}, by ${answer.by.login} at ${answer.at}`,
134
+ ];
135
+ if (answer.note !== null && answer.note.length > 0) {
136
+ lines.push(`Note: ${answer.note}`);
137
+ }
138
+ return lines.join("\n");
139
+ }
140
+ export function formatDecision(decision) {
141
+ const lines = [
142
+ `decision ${decision.id}: ${decision.question}`,
143
+ `asked by ${asker(decision)}${decision.taskNumber === null ? "" : `, about task #${decision.taskNumber}`}`,
144
+ ];
145
+ if (decision.body.trim().length > 0) {
146
+ lines.push("", decision.body.trimEnd());
147
+ }
148
+ lines.push("", "options:", formatOptions(decision), "", formatAnswer(decision));
149
+ return lines.join("\n");
150
+ }
151
+ //# sourceMappingURL=format.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.js","sourceRoot":"","sources":["../../src/cli/format.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAGxC,4FAA4F;AAC5F,gGAAgG;AAChG,8EAA8E;AAE9E,MAAM,MAAM,GAAG,CAAC,KAAa,EAAE,IAAY,EAAU,EAAE,CAAC,GAAG,K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C;IACF,IAAI,MAAM,CAAC,IAAI,KAAK,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACnD,KAAK,CAAC,IAAI,CAAC,SAAS,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;IACrC,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,QAAsB;IACnD,MAAM,KAAK,GAAG;QACZ,YAAY,QAAQ,CAAC,EAAE,KAAK,QAAQ,CAAC,QAAQ,EAAE;QAC/C,YAAY,KAAK,CAAC,QAAQ,CAAC,GAAG,QAAQ,CAAC,UAAU,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,iBAAiB,QAAQ,CAAC,UAAU,EAAE,EAAE;KAC3G,CAAC;IACF,IAAI,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACpC,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;IAC1C,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,UAAU,EAAE,aAAa,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC;IAChF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,16 @@
1
+ export interface CommandHelp {
2
+ /** The command and its arguments, after `console`. */
3
+ readonly usage: string;
4
+ /** What it does, in a sentence. */
5
+ readonly about: string;
6
+ /** What the console holds the arguments to. */
7
+ readonly limits?: readonly string[];
8
+ /** What the console may refuse, by code, and what to do then. */
9
+ readonly refusals?: readonly string[];
10
+ }
11
+ export declare const COMMAND_HELP: Readonly<Record<string, CommandHelp>>;
12
+ /** The whole usage, as `console help` prints it. */
13
+ export declare function usage(): string;
14
+ /** What `console help <command>` prints, or nothing for a command that is not one. */
15
+ export declare function helpFor(name: string): string | undefined;
16
+ //# sourceMappingURL=help.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../../src/cli/help.ts"],"names":[],"mappings":"AAqBA,MAAM,WAAW,WAAW;IAC1B,sDAAsD;IACtD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,mCAAmC;IACnC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,+CAA+C;IAC/C,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,iEAAiE;IACjE,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACvC;AAgBD,eAAO,MAAM,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CA2H9D,CAAC;AAgCF,oDAAoD;AACpD,wBAAgB,KAAK,IAAI,MAAM,CAc9B;AAED,sFAAsF;AACtF,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAaxD"}
@@ -0,0 +1,180 @@
1
+ import { MAX_AGENT_LENGTH, MAX_ARTIFACTS_PER_RUN, MAX_BODY_LENGTH, MAX_FILE_BYTES, MAX_LINK_LABEL_LENGTH, MAX_OPTION_LABEL_LENGTH, MAX_OPTIONS, MAX_QUESTION_LENGTH, MAX_REPORTS_PER_RUN, MAX_SUMMARY_LENGTH, MAX_TITLE_LENGTH, MIN_OPTIONS, } from "../limits.js";
2
+ /** The refusals any command may meet, said once in the overview. */
3
+ const COMMON_REFUSALS = [
4
+ "auth.required: the token is not one the console knows, any more or at all; a person signs the command in again",
5
+ "request.invalid: what was sent is over a limit or malformed; the message names the field",
6
+ "network: the console could not be reached at its address",
7
+ ];
8
+ const RUN_REFUSALS = [
9
+ "run.not_yours: the run is another person's",
10
+ "run.over: the run has ended already",
11
+ ];
12
+ const MARKDOWN = `Markdown, up to ${MAX_BODY_LENGTH} characters`;
13
+ export const COMMAND_HELP = {
14
+ login: {
15
+ usage: "login --url <origin> [--token-stdin]",
16
+ about: "A person signs the command in: it asks for a token made on the console's Tokens page and keeps it, with the console's address, in your home directory. --token-stdin reads the token from standard input instead.",
17
+ refusals: ["the console does not know the token: make one on the Tokens page and try again"],
18
+ },
19
+ logout: {
20
+ usage: "logout",
21
+ about: "Forgets the address and the token kept here. The token itself is removed on the Tokens page.",
22
+ },
23
+ whoami: {
24
+ usage: "whoami",
25
+ about: "Who the token acts as, and which console it is for.",
26
+ },
27
+ tasks: {
28
+ usage: "tasks [--state <state>]",
29
+ about: "The tasks on the board, newest first: number, state, priority, title, who owns and works on each, and what waits on it. States: idea, ready, in_progress, in_review, done, dropped.",
30
+ },
31
+ task: {
32
+ usage: "task <number|id> | task new <title> [--body <markdown>|--file <path>] [--state <state>] [--priority <priority>]",
33
+ about: "One task in full, with the decisions about it and the runs on it; or a new task written down (priorities: low, normal, high, urgent).",
34
+ limits: [`title: one line, up to ${MAX_TITLE_LENGTH} characters`, `body: ${MARKDOWN}`],
35
+ refusals: ["task.not_found: no task has that number or id"],
36
+ },
37
+ skills: {
38
+ usage: "skills",
39
+ about: "The organization's skills, as SkillCDN serves them at the console's address: each with its description and the URI you load it by through your own SkillCDN connection. --json adds the page of each, for a person.",
40
+ },
41
+ take: {
42
+ usage: "take <number|id> [--agent <name>]",
43
+ about: "Takes a task: a run begins, and the task is in progress and the person's. One agent at a time per task. --agent is what people see at work; left out, it is what the person called the token.",
44
+ limits: [`agent: one line, up to ${MAX_AGENT_LENGTH} characters`],
45
+ refusals: [
46
+ "task.not_found: no task has that number or id",
47
+ "run.task_taken: a run is open on the task already; console runs --open --mine shows whether it is yours",
48
+ "run.task_closed: the task is done or dropped",
49
+ ],
50
+ },
51
+ report: {
52
+ usage: "report <markdown> | report --file <path> | report -",
53
+ about: "Says how the work goes, in Markdown: what was found, what was done, what is next. A milestone at a time, not every step. With - the report is read from standard input.",
54
+ limits: [
55
+ `the report: ${MARKDOWN}, not blank`,
56
+ `at most ${MAX_REPORTS_PER_RUN} reports on one run`,
57
+ ],
58
+ refusals: [...RUN_REFUSALS, "run.too_many_reports: the run carries as many as one may"],
59
+ },
60
+ "hand-in": {
61
+ usage: "hand-in <https url | file path> [--label <words>]",
62
+ about: "Hands in what was made: a link (a branch, a pull request, a document, a page), or a file from this machine, which the console keeps and shows on the task.",
63
+ limits: [
64
+ "a link: https only",
65
+ `a file: up to ${MAX_FILE_BYTES} bytes, not empty; it is called by its name, without the path`,
66
+ `label: one line, up to ${MAX_LINK_LABEL_LENGTH} characters`,
67
+ `at most ${MAX_ARTIFACTS_PER_RUN} links and files on one run`,
68
+ ],
69
+ refusals: [
70
+ ...RUN_REFUSALS,
71
+ "run.too_many_artifacts: the run carries as many as one may",
72
+ "request.too_large: the file is over the limit",
73
+ ],
74
+ },
75
+ ask: {
76
+ usage: 'ask "<question>" --option "<label>" --option "<label>" [...] [--body <markdown>|--file <path>] [--wait <seconds>]',
77
+ about: "Raises a decision a person must make: the question, the options to choose from, and what they need to know. The run waits for the answer. The command waits 60 seconds for it unless --wait says otherwise, and exits with 3 if it is still to come: keep waiting with `console decision <id> --wait 100`, within what your shell gives one command, and go on meanwhile only with work that does not depend on the answer. The decision's id is printed as soon as it is raised.",
78
+ limits: [
79
+ `question: one line, up to ${MAX_QUESTION_LENGTH} characters`,
80
+ `options: ${MIN_OPTIONS} to ${MAX_OPTIONS}, each one line up to ${MAX_OPTION_LABEL_LENGTH} characters`,
81
+ `body: ${MARKDOWN}`,
82
+ ],
83
+ refusals: ["decision.invalid_run: the run is not yours, or is over"],
84
+ },
85
+ decision: {
86
+ usage: "decision <id> [--wait <seconds>]",
87
+ about: "One decision, with its options and its answer. With --wait, holds on for the answer that long, and exits with 3 if it is still to come.",
88
+ refusals: ["decision.not_found: no decision has that id"],
89
+ },
90
+ decisions: {
91
+ usage: "decisions [--open]",
92
+ about: "The decisions on the board, the waiting first; --open keeps only those.",
93
+ },
94
+ finish: {
95
+ usage: 'finish [--summary "<markdown>"|--file <path>]',
96
+ about: "Ends the run: the work is done and handed in, and the task goes up for review. The summary says what was done and what is left; the result itself goes in a last report before, which may be much longer.",
97
+ limits: [`summary: ${`Markdown, up to ${MAX_SUMMARY_LENGTH} characters`}`],
98
+ refusals: RUN_REFUSALS,
99
+ },
100
+ fail: {
101
+ usage: 'fail [--summary "<markdown>"|--file <path>]',
102
+ about: "Ends the run: the work could not be done. The summary says why, and what is left.",
103
+ limits: [`summary: Markdown, up to ${MAX_SUMMARY_LENGTH} characters`],
104
+ refusals: RUN_REFUSALS,
105
+ },
106
+ abandon: {
107
+ usage: 'abandon [<run id>] [--summary "<markdown>"]',
108
+ about: "Leaves a run; the task stays as it is. A person gives up this way on a run of theirs that will not come back.",
109
+ limits: [`summary: Markdown, up to ${MAX_SUMMARY_LENGTH} characters`],
110
+ refusals: RUN_REFUSALS,
111
+ },
112
+ runs: {
113
+ usage: "runs [--task <number|id>] [--open] [--mine]",
114
+ about: "The runs, newest first: agents at work and what they did. --mine keeps those begun with this token.",
115
+ },
116
+ run: {
117
+ usage: "run <id>",
118
+ about: "One run in full: its reports, what it handed in, what it waits for, how it ended.",
119
+ refusals: ["run.not_found: no run has that id"],
120
+ },
121
+ };
122
+ const PREAMBLE = `console: the board of your organization's work with AI agents, from the command line.
123
+ You act as the person whose token you hold; everything you send is shown to people as text.
124
+
125
+ Usage: console <command> [arguments] [--json] [--url <origin>]
126
+ `;
127
+ const CLOSING = `Options everywhere: --json answers with the console's own JSON; --url names another console.
128
+ Commands on a run (report, hand-in, ask, finish, fail) act on your one open run; with several open,
129
+ say which with --run <id>. A Markdown body given as - is read from standard input.
130
+ console help <command> says what each command takes, the limits the console holds it to, and
131
+ what it may refuse.
132
+
133
+ Exit codes: 0 done; 1 the console refused, or could not be reached (the reason is on stderr);
134
+ 2 the command was not understood; 3 the decision still waits for a person.
135
+ What the console refuses is printed as its code and its words. Everywhere:
136
+ ${COMMON_REFUSALS.map((refusal) => ` ${refusal}`).join("\n")}
137
+
138
+ Credentials: CONSOLE_URL and CONSOLE_TOKEN in the environment, else what login kept in
139
+ $XDG_CONFIG_HOME/skillcdn-console/credentials.json (~/.config when XDG_CONFIG_HOME is unset).
140
+ `;
141
+ const SECTIONS = [
142
+ { title: "Signing in, once, as a person", commands: ["login", "logout", "whoami"] },
143
+ {
144
+ title: "The board",
145
+ commands: ["tasks", "task", "decisions", "decision", "runs", "run", "skills"],
146
+ },
147
+ { title: "Working", commands: ["take", "report", "hand-in", "ask", "finish", "fail", "abandon"] },
148
+ ];
149
+ /** The whole usage, as `console help` prints it. */
150
+ export function usage() {
151
+ const parts = [PREAMBLE];
152
+ for (const section of SECTIONS) {
153
+ parts.push(`${section.title}`);
154
+ for (const name of section.commands) {
155
+ const help = COMMAND_HELP[name];
156
+ if (help !== undefined) {
157
+ parts.push(` console ${help.usage}\n ${help.about}`);
158
+ }
159
+ }
160
+ parts.push("");
161
+ }
162
+ parts.push(CLOSING);
163
+ return parts.join("\n");
164
+ }
165
+ /** What `console help <command>` prints, or nothing for a command that is not one. */
166
+ export function helpFor(name) {
167
+ const help = COMMAND_HELP[name];
168
+ if (help === undefined) {
169
+ return undefined;
170
+ }
171
+ const parts = [`console ${help.usage}`, "", help.about];
172
+ if (help.limits !== undefined) {
173
+ parts.push("", "Limits:", ...help.limits.map((limit) => ` ${limit}`));
174
+ }
175
+ if (help.refusals !== undefined) {
176
+ parts.push("", "Refusals:", ...help.refusals.map((refusal) => ` ${refusal}`));
177
+ }
178
+ return `${parts.join("\n")}\n`;
179
+ }
180
+ //# sourceMappingURL=help.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"help.js","sourceRoot":"","sources":["../../src/cli/help.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,qBAAqB,EACrB,eAAe,EACf,cAAc,EACd,qBAAqB,EACrB,uBAAuB,E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sourceMappingURL=main.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":""}
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/env node
2
+ import process from "node:process";
3
+ import { runCli } from "./cli.js";
4
+ import { createFileStore, defaultConfigDir } from "./credentials.js";
5
+ import { readBytesAt, readFileAt, readSecret, readStdin } from "./terminal.js";
6
+ // The `console` command: the only place the command reads the process. Everything it does is in
7
+ // cli.ts, which takes what it needs and is what the tests run.
8
+ process.exitCode = await runCli(process.argv.slice(2), {
9
+ env: process.env,
10
+ stdout: (text) => {
11
+ process.stdout.write(text);
12
+ },
13
+ stderr: (text) => {
14
+ process.stderr.write(text);
15
+ },
16
+ fetch: (input, init) => fetch(input, init),
17
+ readStdin,
18
+ readSecret,
19
+ readFile: readFileAt,
20
+ readBytes: readBytesAt,
21
+ store: createFileStore(defaultConfigDir(process.env)),
22
+ sleep: (ms) => new Promise((resolve) => setTimeout(resolve, ms)),
23
+ now: () => Date.now(),
24
+ });
25
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":";AACA,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE/E,gGAAgG;AAChG,+DAA+D;AAE/D,OAAO,CAAC,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;IACrD,GAAG,EAAE,OAAO,CAAC,GAAG;IAChB,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;QACf,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;IACD,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;QACf,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;IACD,KAAK,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC;IAC1C,SAAS;IACT,UAAU;IACV,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,WAAW;IACtB,KAAK,EAAE,eAAe,CAAC,gBAAgB,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACrD,KAAK,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;IAChE,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE;CACtB,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ /** All of standard input, once it ends. */
2
+ export declare function readStdin(): Promise<string>;
3
+ /**
4
+ * A secret typed at the terminal, shown as nothing while it is typed; when standard input is
5
+ * not a terminal, its first line.
6
+ */
7
+ export declare function readSecret(prompt: string): Promise<string>;
8
+ /** A file named on the command line, as text. */
9
+ export declare function readFileAt(path: string): Promise<string>;
10
+ /** A file named on the command line, as bytes: what is handed in. */
11
+ export declare function readBytesAt(path: string): Promise<Uint8Array>;
12
+ //# sourceMappingURL=terminal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"terminal.d.ts","sourceRoot":"","sources":["../../src/cli/terminal.ts"],"names":[],"mappings":"AAMA,2CAA2C;AAC3C,wBAAgB,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,CAU3C;AAED;;;GAGG;AACH,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAsChE;AAED,iDAAiD;AACjD,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAExD;AAED,qEAAqE;AACrE,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAE7D"}
@@ -0,0 +1,68 @@
1
+ import { readFile } from "node:fs/promises";
2
+ import process from "node:process";
3
+ // The terminal's side of the command: what is read from it. Nothing here is reached by tests,
4
+ // which hand the command readers of their own.
5
+ /** All of standard input, once it ends. */
6
+ export function readStdin() {
7
+ return new Promise((resolve, reject) => {
8
+ let content = "";
9
+ process.stdin.setEncoding("utf8");
10
+ process.stdin.on("data", (chunk) => {
11
+ content += chunk;
12
+ });
13
+ process.stdin.on("end", () => resolve(content));
14
+ process.stdin.on("error", reject);
15
+ });
16
+ }
17
+ /**
18
+ * A secret typed at the terminal, shown as nothing while it is typed; when standard input is
19
+ * not a terminal, its first line.
20
+ */
21
+ export async function readSecret(prompt) {
22
+ const { stdin, stderr } = process;
23
+ if (!stdin.isTTY) {
24
+ return (await readStdin()).split(/\r?\n/, 1)[0] ?? "";
25
+ }
26
+ stderr.write(prompt);
27
+ return new Promise((resolve, reject) => {
28
+ let value = "";
29
+ const done = () => {
30
+ stdin.setRawMode(false);
31
+ stdin.pause();
32
+ stdin.off("data", onData);
33
+ stderr.write("\n");
34
+ };
35
+ const onData = (chunk) => {
36
+ for (const character of chunk) {
37
+ if (character === "\u0003") {
38
+ done();
39
+ reject(new Error("interrupted"));
40
+ return;
41
+ }
42
+ if (character === "\r" || character === "\n") {
43
+ done();
44
+ resolve(value);
45
+ return;
46
+ }
47
+ if (character === "\u007f" || character === "\b") {
48
+ value = value.slice(0, -1);
49
+ continue;
50
+ }
51
+ value += character;
52
+ }
53
+ };
54
+ stdin.setRawMode(true);
55
+ stdin.setEncoding("utf8");
56
+ stdin.resume();
57
+ stdin.on("data", onData);
58
+ });
59
+ }
60
+ /** A file named on the command line, as text. */
61
+ export function readFileAt(path) {
62
+ return readFile(path, "utf8");
63
+ }
64
+ /** A file named on the command line, as bytes: what is handed in. */
65
+ export function readBytesAt(path) {
66
+ return readFile(path);
67
+ }
68
+ //# sourceMappingURL=terminal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"terminal.js","sourceRoot":"","sources":["../../src/cli/terminal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,OAAO,MAAM,cAAc,CAAC;AAEnC,8FAA8F;AAC9F,+CAA+C;AAE/C,2CAA2C;AAC3C,MAAM,UAAU,SAAS;IACvB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,IAAI,OAAO,GAAG,EAAE,CAAC;QACjB,OAAO,CAAC,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;QAClC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAa,EAAE,EAAE;YACzC,OAAO,IAAI,KAAK,CAAC;QACnB,CAAC,CAAC,CAAC;QACH,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;QAChD,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,MAAc;IAC7C,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAClC,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACjB,OAAO,CAAC,MAAM,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACxD,CAAC;IACD,MAAM,CAAC,KAAK,CAAC,MAAM,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DAAiD;AACjD,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,OAAO,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAChC,CAAC;AAED,qEAAqE;AACrE,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC;AACxB,CAAC"}
@@ -0,0 +1,92 @@
1
+ import { type RestAnswerInput, type RestArtifactInput, type RestDecision, type RestDecisionInput, type RestDecisions, type RestEvents, type RestMe, type RestPeople, type RestPerson, type RestPersonPatch, type RestReportInput, type RestRun, type RestRunEndInput, type RestRunInput, type RestRuns, type RestSkills, type RestTask, type RestTaskInput, type RestTaskPatch, type RestTasks, type RestTokenCreated, type RestTokenInput, type RestTokens } from "./schemas.js";
2
+ import type { TaskState } from "./vocabulary.js";
3
+ export type FetchLike = (input: string, init?: RequestInit) => Promise<Response>;
4
+ /** A file to hand in: its bytes, what to call it, and what it is. */
5
+ export interface FileUpload {
6
+ /** The file's name, without a path. */
7
+ readonly name: string;
8
+ readonly bytes: Uint8Array | Blob;
9
+ /** The media type; `application/octet-stream` when left out. */
10
+ readonly contentType?: string | undefined;
11
+ readonly label?: string | undefined;
12
+ }
13
+ export interface ClientOptions {
14
+ /** The origin of the console, without a path. Empty: the origin of the page. */
15
+ readonly baseUrl?: string;
16
+ /** The platform's `fetch` when left out. Tests hand in one that never leaves the process. */
17
+ readonly fetch?: FetchLike;
18
+ /**
19
+ * A token a person made, for an agent, a script or a console of their own: sent as
20
+ * `Authorization: Bearer`, and the browser's cookies left out. Left out, the session cookie of
21
+ * the page's own origin is what the console answers to.
22
+ */
23
+ readonly token?: string;
24
+ }
25
+ export declare class ApiError extends Error {
26
+ /** HTTP status, or 0 when there was no response at all. */
27
+ readonly status: number;
28
+ /** The stable code from the error body, `network` or `invalid_response`. */
29
+ readonly code: string;
30
+ constructor(status: number, code: string, message: string);
31
+ }
32
+ export interface ConsoleClient {
33
+ me(signal?: AbortSignal): Promise<RestMe>;
34
+ people(signal?: AbortSignal): Promise<RestPeople>;
35
+ /** Changes what a person is; for an administrator. */
36
+ updatePerson(id: string, patch: RestPersonPatch): Promise<RestPerson>;
37
+ tasks(filter?: {
38
+ readonly state?: TaskState;
39
+ }, signal?: AbortSignal): Promise<RestTasks>;
40
+ /** One task, by its id or by its number. */
41
+ task(ref: string, signal?: AbortSignal): Promise<RestTask>;
42
+ createTask(input: RestTaskInput): Promise<RestTask>;
43
+ updateTask(id: string, patch: RestTaskPatch): Promise<RestTask>;
44
+ /** The decisions, or only those that wait, or only those about one task. */
45
+ decisions(filter?: {
46
+ readonly open?: boolean;
47
+ readonly task?: string;
48
+ }, signal?: AbortSignal): Promise<RestDecisions>;
49
+ decision(id: string, signal?: AbortSignal): Promise<RestDecision>;
50
+ /**
51
+ * One decision, after waiting up to `waitSeconds` for its answer: the server holds the request
52
+ * while the decision waits, for as long as it allows, and answers the decision as it stands.
53
+ */
54
+ awaitDecision(id: string, waitSeconds: number, signal?: AbortSignal): Promise<RestDecision>;
55
+ raiseDecision(input: RestDecisionInput): Promise<RestDecision>;
56
+ answerDecision(id: string, input: RestAnswerInput): Promise<RestDecision>;
57
+ /** The runs, newest first; or only those on one task, only the open ones, only the asker's own. */
58
+ runs(filter?: {
59
+ readonly task?: string;
60
+ readonly open?: boolean;
61
+ readonly mine?: boolean;
62
+ }, signal?: AbortSignal): Promise<RestRuns>;
63
+ run(id: string, signal?: AbortSignal): Promise<RestRun>;
64
+ /** Takes a task: a run begins, for the person the asker is or acts for. */
65
+ startRun(input: RestRunInput): Promise<RestRun>;
66
+ /** Says how the work goes, on a run of the asker's. */
67
+ report(runId: string, input: RestReportInput): Promise<RestRun>;
68
+ /** Hands in a link, on a run of the asker's. */
69
+ handIn(runId: string, input: RestArtifactInput): Promise<RestRun>;
70
+ /** Hands in a file, on a run of the asker's: the console keeps the bytes. */
71
+ handInFile(runId: string, input: FileUpload): Promise<RestRun>;
72
+ /** Where the bytes of a file handed in are read, by the artifact's id. */
73
+ fileUrl(artifactId: string): string;
74
+ /** Ends a run: finished or failed by the agent; abandoned by the person it is for, or an administrator. */
75
+ endRun(runId: string, input: RestRunEndInput): Promise<RestRun>;
76
+ /** What happened after event number `after`; `0` for the beginning. */
77
+ events(after: number, signal?: AbortSignal): Promise<RestEvents>;
78
+ /** Where an `EventSource` subscribes to what happens after event number `after`. */
79
+ eventStreamUrl(after: number): string;
80
+ /** The organization's skills, as SkillCDN serves them at the console's address. */
81
+ skills(signal?: AbortSignal): Promise<RestSkills>;
82
+ /** The tokens of whoever asks. */
83
+ tokens(signal?: AbortSignal): Promise<RestTokens>;
84
+ /** Makes a token; the answer carries the secret, this once. */
85
+ createToken(input: RestTokenInput): Promise<RestTokenCreated>;
86
+ /** Takes a token away, whoever holds it. */
87
+ revokeToken(id: string): Promise<void>;
88
+ /** Ends the session on this browser. */
89
+ signOut(): Promise<void>;
90
+ }
91
+ export declare function createClient(options?: ClientOptions): ConsoleClient;
92
+ //# sourceMappingURL=client.d.ts.map