@kosuke-ai/kosuke 1.0.59 → 1.0.61

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 (85) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +31 -2
  3. package/dist/commands/hand-written.js +15 -0
  4. package/dist/commands/help.js +52 -0
  5. package/dist/generated/commands/crons/create--personal.js +2 -1
  6. package/dist/generated/commands/crons/update--personal.js +2 -1
  7. package/dist/generated/commands/deploys/queue-update.js +2 -1
  8. package/dist/generated/commands/devices/list.js +1 -1
  9. package/dist/generated/commands/find/index.js +17 -0
  10. package/dist/generated/commands/index.js +279 -291
  11. package/dist/generated/commands/integrations/tools-call.js +2 -1
  12. package/dist/generated/commands/mac/files-delete.js +1 -1
  13. package/dist/generated/commands/mac/files-move.js +1 -1
  14. package/dist/generated/commands/mac/files-set.js +1 -1
  15. package/dist/generated/commands/mac/shell.js +1 -1
  16. package/dist/generated/commands/projects/batch-merging-get.js +1 -1
  17. package/dist/generated/commands/projects/batch-merging-picks-set.js +2 -1
  18. package/dist/generated/commands/projects/batch-merging-set.js +19 -1
  19. package/dist/generated/commands/projects/create.js +21 -9
  20. package/dist/generated/commands/projects/labels-delete.js +2 -1
  21. package/dist/generated/commands/projects/live-logs-list.js +1 -1
  22. package/dist/generated/commands/projects/live-queries-run.js +1 -1
  23. package/dist/generated/commands/projects/live-traffic-get.js +1 -1
  24. package/dist/generated/commands/projects/releases-list.js +1 -1
  25. package/dist/generated/commands/projects/services-create.js +6 -3
  26. package/dist/generated/commands/projects/services-update.js +6 -3
  27. package/dist/generated/commands/projects/settings-set.js +12 -2
  28. package/dist/generated/commands/projects/settings-update.js +9 -1
  29. package/dist/generated/commands/projects/versions-list.js +1 -1
  30. package/dist/generated/commands/sensei/cards-mark-read.js +1 -1
  31. package/dist/generated/commands/sensei/cards-set.js +40 -10
  32. package/dist/generated/commands/sensei/connect-buttons-create.js +2 -1
  33. package/dist/generated/commands/sensei/describe-cards-create.js +1 -1
  34. package/dist/generated/commands/sensei/messages-send.js +2 -1
  35. package/dist/generated/commands/sensei/sessions-assessments-create.js +3 -1
  36. package/dist/generated/commands/sensei/sessions-facts-get.js +1 -1
  37. package/dist/generated/commands/sensei/suggestions-create.js +2 -1
  38. package/dist/generated/commands/sensei/threads-get.js +8 -1
  39. package/dist/generated/commands/sensei/threads-split.js +2 -1
  40. package/dist/generated/commands/sensei/tickets-merge.js +4 -2
  41. package/dist/generated/commands/sensei/watch-reads-finish.js +4 -2
  42. package/dist/generated/commands/sensei/writing-samples-create.js +2 -1
  43. package/dist/generated/commands/sessions/labels-set.js +6 -3
  44. package/dist/generated/commands/sessions/labels-update.js +4 -2
  45. package/dist/generated/commands/sessions/list--all.js +2 -3
  46. package/dist/generated/commands/sessions/qa-runs-finish.js +2 -1
  47. package/dist/generated/commands/sessions/qa-runs-results-create.js +2 -1
  48. package/dist/generated/commands/sessions/qa-runs-start.js +2 -1
  49. package/dist/generated/commands/sessions/queue-update.js +2 -1
  50. package/dist/generated/commands/sessions/send.js +4 -2
  51. package/dist/generated/commands/sessions/update.js +2 -1
  52. package/dist/generated/commands/skills/create--personal.js +2 -1
  53. package/dist/generated/commands/skills/create.js +2 -1
  54. package/dist/generated/commands/skills/update--personal.js +2 -1
  55. package/dist/generated/commands/skills/update.js +2 -1
  56. package/dist/generated/commands/tasks/create--personal.js +235 -11
  57. package/dist/generated/commands/tasks/create.js +1 -1
  58. package/dist/generated/commands/tasks/delete--personal.js +6 -3
  59. package/dist/generated/commands/tasks/get--personal.js +6 -3
  60. package/dist/generated/commands/tasks/list--all.js +1 -1
  61. package/dist/generated/commands/tasks/list--personal.js +91 -9
  62. package/dist/generated/commands/tasks/move--personal.js +7 -4
  63. package/dist/generated/commands/tasks/start--personal.js +6 -3
  64. package/dist/generated/commands/tasks/update--personal.js +85 -10
  65. package/dist/generated/commands/tasks/update.js +3 -2
  66. package/dist/generated/commands/user/personal-space-get.js +19 -0
  67. package/dist/generated/commands/workspaces/sandboxes-stop.js +2 -1
  68. package/dist/program.js +13 -2
  69. package/dist/runtime/arguments.js +58 -0
  70. package/dist/runtime/attach.js +177 -18
  71. package/dist/runtime/help.js +398 -0
  72. package/dist/runtime/personal-space-id.js +26 -0
  73. package/dist/runtime/personal-space.js +10 -0
  74. package/dist/runtime/runtime.js +25 -5
  75. package/dist/runtime/thread-text.js +316 -0
  76. package/openapi.json +340 -604
  77. package/package.json +4 -4
  78. package/dist/generated/commands/projects/backlog-items-create.js +0 -35
  79. package/dist/generated/commands/projects/backlog-items-delete.js +0 -20
  80. package/dist/generated/commands/projects/backlog-items-list.js +0 -19
  81. package/dist/generated/commands/projects/backlog-items-send.js +0 -20
  82. package/dist/generated/commands/projects/backlog-items-update.js +0 -42
  83. package/dist/generated/commands/projects/live-writes-create.js +0 -38
  84. package/dist/generated/commands/projects/live-writes-get.js +0 -21
  85. package/dist/generated/commands/projects/workflow-set.js +0 -33
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.61
4
+
5
+ - A Chat Session's shell and file writes on a Mac stay in its scratch folder ~/KosukeQA/<session8>/, Xcode DerivedData, CoreSimulator, the temporary folders and the folders its project declares in deviceWritePaths, which a member sets with `kosuke projects settings update --device-write-paths`. A write elsewhere fails. Sensei's own Mac calls are unchanged.
6
+
7
+ ## 1.0.60
8
+
9
+ - `kosuke projects batch-merging set` takes `--go-ahead` (member or checks) and `--wait-for-qa`, and `get` reads them. Apps are gone: `projects create --workflow`, `projects workflow set`, `projects backlog-items` and `projects live writes` are removed.
10
+ - `kosuke sessions qa runs results create` now takes a structured `standin` (`simulator` and `replaces`) and refuses a pass or failure of a `[sim: <name>]` checklist item whose result does not name that simulator.
11
+ - `tasks list`, `create`, `get`, `update`, `delete`, `move` and `start` with `personal` now read your Personal space id from the new `user personal-space get` and call the workspace task routes with it, so they take every flag of the workspace form and answer workspace tasks. `tasks create personal` now needs `--description` (`--description ""` for none), and `--if-revision` on `tasks update personal` is the task's `descriptionRevision`. Session and Cron keys are refused `personal`. The `/api/personal-tasks` endpoints older CLIs call are deprecated and keep working for now.
12
+ - A Chat Turn or Cron Run reader the sandbox agent paused goes on once its bytes have left, even when the socket's drain event never comes, instead of being dropped after 30 seconds. A Cron Run reattach resumes after the last event it holds (`Last-Event-ID`) instead of replaying the whole run.
13
+ - `kosuke sensei cards mark-read` says to run it again when a WhatsApp read receipt could not be confirmed.
14
+ - The CLI is cheaper for agents to learn and call. `--help` prints the usage line, the first sentence and one line per flag, and `--help --long` the full text with each JSON flag's shape; `kosuke help --compact` lists every command with its arguments in one screen, and `kosuke sensei cards schema [field]` prints the card rules. `kosuke find` looks up a session by PR number, id or title, and every command that took a project and a session id now takes the session id alone or `--session-id`, its project looked up. A command with a `--session-id` field takes the id as a positional too, `--repository` takes `owner/repo`, and an unknown command or flag prints the one it meant. `kosuke sensei threads get` prints the thread's words by default, `--tools` the whole response. Piped output is one JSON line, a list one row per line; `--pretty` restores the indented form.
15
+ - `sessions qa runs start --sync-file` accepts a sync scope that carries QA from the last passed head (`since`) across several sync merges.
16
+ - `kosuke projects batch-merging set` takes `--go-ahead member|checks` and `--wait-for-qa`, and `get` reads them back; the Describe card now creates a repository from kosuke-starter, and `sessions list --kind` no longer offers `apps`.
17
+
3
18
  ## 1.0.59
4
19
 
5
20
  - `kosuke sessions get` names the Sensei thread that follows the session.
package/README.md CHANGED
@@ -17,18 +17,47 @@ kosuke crons create <workspaceId> --project <projectId> --project <projectId> \
17
17
  kosuke workspaces timezone set <workspaceId> --timezone Europe/Zurich
18
18
  ```
19
19
 
20
- Every API command prints the platform's JSON response as is, so it pipes into `jq`.
20
+ Every API command prints the platform's JSON response, so it pipes into `jq`.
21
21
  Path params are positional, request fields are flags (`--exclude-archived`,
22
22
  `--start-line-number 12`, and `--project a --project b` where a field takes
23
23
  several values), and any body can be passed whole with `--body '{…}'`,
24
24
  `--body-file path` or `--body-file -` for stdin. `kosuke <group> --help` lists
25
- the operations; each one's help is the API's own description.
25
+ the operations; `--help --long` prints each one's help as the API describes it.
26
26
 
27
27
  The API key comes from `--api-key`, then `KOSUKE_API_KEY`, then the file
28
28
  `kosuke auth login` writes (mode 0600, under `~/.config/kosuke`, or
29
29
  `KOSUKE_CONFIG_DIR`). `--api-url` / `KOSUKE_API_URL` point it at another
30
30
  deployment.
31
31
 
32
+ ## Help, lookup and output
33
+
34
+ `--help` is short: the usage line, the description's first sentence and one line per flag.
35
+ A help that cut anything ends with `Full text: --help --long`, which prints every description
36
+ whole, with the shape of each JSON flag. `kosuke help --compact` lists every command your key
37
+ reaches with its arguments, one line per command group. `kosuke sensei cards schema` prints
38
+ the rules of every `sensei cards set` field; `kosuke sensei cards schema blocks` prints one.
39
+
40
+ ```sh
41
+ kosuke find 3323 # a PR number, a session or task id, or title words
42
+ kosuke sessions get <sessionId> # the project is looked up; <projectId> <sessionId> still works
43
+ kosuke sessions jobs list --session-id <sessionId>
44
+ kosuke sensei sessions facts get <sessionId>
45
+ kosuke sensei threads get <threadId> --since <messageId>
46
+ ```
47
+
48
+ `kosuke find` prints one row per match: its workspace, project, session, thread, task, pull
49
+ request number and head SHA. A command whose path starts with the project and session ids
50
+ takes the session id alone, or `--session-id`, and reads its project with the same lookup; a
51
+ command with a `--session-id` field also takes the id as its one positional. `--repository`
52
+ takes `owner/repo` as well as JSON. A command or flag that does not exist prints the one it
53
+ meant.
54
+
55
+ `kosuke sensei threads get` prints the thread's words: the member's messages, Sensei's
56
+ replies and card headlines. `--tools` prints the platform's response, tool blocks included.
57
+
58
+ At a terminal the JSON is indented. Piped, it is one line, and a top-level `data` list prints
59
+ one row per line, still one JSON document. `--pretty` indents it anywhere.
60
+
32
61
  ## Factory Skill markers
33
62
 
34
63
  The main chat agent records Factory Skill boundaries with these commands:
@@ -10,6 +10,21 @@ const SKILL_RUN_FLAGS = [
10
10
  '--evidence',
11
11
  ];
12
12
  export const HAND_WRITTEN = {
13
+ help: {
14
+ command: ['help'],
15
+ positionals: ['command'],
16
+ flags: ['--compact'],
17
+ agents: 'all',
18
+ workspace: true,
19
+ },
20
+ // Local text from the `sensei cards set` descriptor, attached wherever that command is.
21
+ senseiCardsSchema: {
22
+ command: ['sensei', 'cards', 'schema'],
23
+ positionals: ['field'],
24
+ flags: [],
25
+ agents: 'all',
26
+ workspace: true,
27
+ },
13
28
  authLogin: {
14
29
  command: ['auth', 'login'],
15
30
  positionals: [],
@@ -0,0 +1,52 @@
1
+ import { Argument } from 'commander';
2
+ import { HAND_WRITTEN } from './hand-written.js';
3
+ import { leafAt } from '../runtime/attach.js';
4
+ import { cardSchema, compactHelp, unknownCommand } from '../runtime/help.js';
5
+ const defaultWrite = (line) => {
6
+ process.stdout.write(`${line}\n`);
7
+ };
8
+ /**
9
+ * `kosuke help [command...]`, in place of commander's own: the help of the named command, as
10
+ * `kosuke <command> --help` prints it, or with `--compact` the whole tree this key reaches, one
11
+ * line per group.
12
+ */
13
+ export function attachHelpCommand(program, write = defaultWrite) {
14
+ program.helpCommand(false);
15
+ leafAt(program, HAND_WRITTEN.help.command)
16
+ .description('Show the help of a command, or with --compact every command in one screen.')
17
+ .addArgument(new Argument('[command...]', 'The command words, such as sessions get.'))
18
+ .option('--compact', 'Every command with its arguments, one line per command group.')
19
+ .action((words, options) => {
20
+ if (options.compact) {
21
+ write(compactHelp(program));
22
+ return;
23
+ }
24
+ let target = program;
25
+ for (const word of words) {
26
+ const next = target.commands.find((command) => command.name() === word);
27
+ if (!next)
28
+ unknownCommand(target, word);
29
+ target = next;
30
+ }
31
+ target.outputHelp();
32
+ });
33
+ }
34
+ /**
35
+ * `kosuke sensei cards schema [field]`: the card rules of `sensei cards set`, read from its
36
+ * descriptor, beside it wherever the key reaches it.
37
+ */
38
+ export function attachCardSchemaCommand(program, cardsSet, write = defaultWrite) {
39
+ const schema = leafAt(program, HAND_WRITTEN.senseiCardsSchema.command)
40
+ .description('Print the rules of every kosuke sensei cards set field, or of one by name or flag.')
41
+ .addArgument(new Argument('[field]', 'One field, as blocks or --negative-label.'))
42
+ // So a field named by its flag, `--negative-label`, arrives as the argument.
43
+ .allowUnknownOption()
44
+ .action((field) => {
45
+ try {
46
+ write(cardSchema(cardsSet, field));
47
+ }
48
+ catch (error) {
49
+ schema.error(`error: ${error instanceof Error ? error.message : String(error)}`);
50
+ }
51
+ });
52
+ }
@@ -53,7 +53,8 @@ export const operation = {
53
53
  "flag": "model",
54
54
  "kind": "json",
55
55
  "required": false,
56
- "description": "An encoded model id such as anthropic:opus__xhigh, one your Sensei runs on your own Subscription, or kosuke-free for Auto - Sensei free while you hold no Subscription. With repositories, an explicit Model of a released provider your Subscription runs, or kosuke-free, is required. Without repositories, null runs on the thread's model."
56
+ "description": "An encoded model id such as anthropic:opus__xhigh, one your Sensei runs on your own Subscription, or kosuke-free for Auto - Sensei free while you hold no Subscription. With repositories, an explicit Model of a released provider your Subscription runs, or kosuke-free, is required. Without repositories, null runs on the thread's model.",
57
+ "shape": "\"kosuke-free\" | string | null"
57
58
  }
58
59
  ],
59
60
  "required": true
@@ -55,7 +55,8 @@ export const operation = {
55
55
  "flag": "model",
56
56
  "kind": "json",
57
57
  "required": false,
58
- "description": "An encoded model id such as anthropic:opus__xhigh, one your Sensei runs on your own Subscription, or kosuke-free for Auto - Sensei free while you hold no Subscription. With repositories, an explicit Model of a released provider your Subscription runs, or kosuke-free, is required. Without repositories, null runs on the thread's model."
58
+ "description": "An encoded model id such as anthropic:opus__xhigh, one your Sensei runs on your own Subscription, or kosuke-free for Auto - Sensei free while you hold no Subscription. With repositories, an explicit Model of a released provider your Subscription runs, or kosuke-free, is required. Without repositories, null runs on the thread's model.",
59
+ "shape": "\"kosuke-free\" | string | null"
59
60
  },
60
61
  {
61
62
  "name": "enabled",
@@ -26,7 +26,8 @@ export const operation = {
26
26
  "flag": "retained-attachment-ids",
27
27
  "kind": "json",
28
28
  "required": false,
29
- "description": "The ids of the files to keep. Omitted keeps them all."
29
+ "description": "The ids of the files to keep. Omitted keeps them all.",
30
+ "shape": "string[]"
30
31
  }
31
32
  ],
32
33
  "required": true
@@ -5,7 +5,7 @@ export const operation = {
5
5
  "devices",
6
6
  "list"
7
7
  ],
8
- "summary": "From a Chat Session: the devices it may use, the workspace's devices and the session member's own Macs, each with its id, kind, whether it is online, the tools it offers, its macOS grants (grants.systemEvents: menu bar icons open with `osascript` through System Events), this session's access: none, pending or approved (a workspace device is always approved: it needs no request), and occupied with occupiedBy (session or sensei) when someone else uses it now. Pick an online device with the tools the test needs: a workspace device first, and the member's own Mac only when no workspace device fits, whatever the names or past approvals. Of those, pick a free one, and ask for an occupied one only when no free device fits. Use a workspace device at once with --device-id; request a personal Mac with `kosuke devices requests create` before any mac command on it. Use a device only when the test truly needs a real Mac. One session at a time uses a device: on MAC_BUSY, wait in its line with `kosuke devices locks create` rather than give up or call again, and let it go with `kosuke devices locks delete` once done.",
8
+ "summary": "From a Chat Session: the devices it may use, the workspace's devices and the session member's own Macs, each with its id, kind, whether it is online, the tools it offers, its macOS grants (grants.systemEvents is for Sensei's `osascript` through System Events: a session's shell runs in its fence, where macOS refuses Apple Events, so a session opens menu bar icons with `kosuke mac click`), this session's access: none, pending or approved (a workspace device is always approved: it needs no request), and occupied with occupiedBy (session or sensei) when someone else uses it now. Pick an online device with the tools the test needs: a workspace device first, and the member's own Mac only when no workspace device fits, whatever the names or past approvals. Of those, pick a free one, and ask for an occupied one only when no free device fits. Use a workspace device at once with --device-id; request a personal Mac with `kosuke devices requests create` before any mac command on it. Use a device only when the test truly needs a real Mac. One session at a time uses a device: on MAC_BUSY, wait in its line with `kosuke devices locks create` rather than give up or call again, and let it go with `kosuke devices locks delete` once done.",
9
9
  "pathParams": [],
10
10
  "query": [],
11
11
  "body": null,
@@ -0,0 +1,17 @@
1
+ export const operation = {
2
+ "method": "get",
3
+ "path": "/api/find/{query}",
4
+ "command": [
5
+ "find"
6
+ ],
7
+ "summary": "Find sessions and tasks by pull request number, session, task or Sensei Thread id, or title words (every word, any case), across what `kosuke sessions list` reaches, archived and ended ones included. One row per match, at most 20, exact matches first, then live before ended: match, workspaceId, workspaceName, projectId, projectName, sessionId, sessionTitle, status, threadId (your own Sensei Thread that follows it), taskId, pullRequestNumber, headSha and url. A task with no session has a null sessionId. An agent token finds within its own workspace.",
8
+ "pathParams": [
9
+ "query"
10
+ ],
11
+ "query": [],
12
+ "body": null,
13
+ "multipart": null,
14
+ "attachments": false,
15
+ "anonymous": false,
16
+ "agents": "all"
17
+ };