toolcraft 0.0.22 → 0.0.24

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 (147) hide show
  1. package/README.md +2 -2
  2. package/dist/cli.compile-check.js +1 -0
  3. package/dist/cli.d.ts +1 -0
  4. package/dist/cli.js +57 -14
  5. package/dist/error-report.js +32 -3
  6. package/dist/human-in-loop/approval-tasks.d.ts +1 -0
  7. package/dist/human-in-loop/approval-tasks.js +7 -5
  8. package/dist/human-in-loop/approvals-commands.js +51 -8
  9. package/dist/human-in-loop/runner.js +24 -19
  10. package/dist/human-in-loop/state-machine.d.ts +3 -3
  11. package/dist/human-in-loop/state-machine.js +13 -5
  12. package/dist/index.d.ts +5 -0
  13. package/dist/index.js +6 -1
  14. package/dist/mcp-proxy.js +85 -19
  15. package/dist/mcp.compile-check.js +1 -0
  16. package/dist/mcp.d.ts +1 -0
  17. package/dist/mcp.js +50 -8
  18. package/dist/renderer.js +119 -13
  19. package/dist/sdk.compile-check.js +1 -0
  20. package/dist/sdk.d.ts +1 -0
  21. package/dist/sdk.js +56 -11
  22. package/node_modules/@poe-code/agent-defs/dist/registry.d.ts +1 -1
  23. package/node_modules/@poe-code/agent-defs/dist/registry.js +22 -11
  24. package/node_modules/@poe-code/agent-defs/package.json +1 -1
  25. package/node_modules/@poe-code/agent-human-in-loop/dist/providers/osascript-script.js +5 -1
  26. package/node_modules/@poe-code/agent-human-in-loop/dist/providers/osascript.js +1 -1
  27. package/node_modules/@poe-code/agent-human-in-loop/package.json +1 -1
  28. package/node_modules/@poe-code/agent-mcp-config/dist/apply.d.ts +1 -1
  29. package/node_modules/@poe-code/agent-mcp-config/dist/apply.js +41 -92
  30. package/node_modules/@poe-code/agent-mcp-config/dist/configs.js +4 -1
  31. package/node_modules/@poe-code/agent-mcp-config/dist/shapes.d.ts +14 -2
  32. package/node_modules/@poe-code/agent-mcp-config/dist/shapes.js +11 -4
  33. package/node_modules/@poe-code/agent-mcp-config/package.json +1 -1
  34. package/node_modules/@poe-code/config-mutations/dist/execution/apply-mutation.js +200 -22
  35. package/node_modules/@poe-code/config-mutations/dist/execution/path-utils.js +7 -1
  36. package/node_modules/@poe-code/config-mutations/dist/formats/index.js +1 -1
  37. package/node_modules/@poe-code/config-mutations/dist/formats/json.js +11 -7
  38. package/node_modules/@poe-code/config-mutations/dist/formats/object.d.ts +4 -0
  39. package/node_modules/@poe-code/config-mutations/dist/formats/object.js +27 -0
  40. package/node_modules/@poe-code/config-mutations/dist/formats/toml.js +12 -9
  41. package/node_modules/@poe-code/config-mutations/dist/formats/yaml.js +12 -9
  42. package/node_modules/@poe-code/config-mutations/dist/mutations/file-mutation.d.ts +11 -1
  43. package/node_modules/@poe-code/config-mutations/dist/mutations/file-mutation.js +10 -1
  44. package/node_modules/@poe-code/config-mutations/dist/testing/mock-fs.js +25 -1
  45. package/node_modules/@poe-code/config-mutations/dist/types.d.ts +12 -2
  46. package/node_modules/@poe-code/config-mutations/package.json +1 -1
  47. package/node_modules/@poe-code/design-system/dist/acp/components.js +3 -1
  48. package/node_modules/@poe-code/design-system/dist/components/browser.d.ts +1 -1
  49. package/node_modules/@poe-code/design-system/dist/components/browser.js +6 -1
  50. package/node_modules/@poe-code/design-system/dist/components/color.js +9 -8
  51. package/node_modules/@poe-code/design-system/dist/components/command-errors.js +3 -2
  52. package/node_modules/@poe-code/design-system/dist/components/detail-card.d.ts +22 -0
  53. package/node_modules/@poe-code/design-system/dist/components/detail-card.js +69 -0
  54. package/node_modules/@poe-code/design-system/dist/components/help-formatter.js +88 -11
  55. package/node_modules/@poe-code/design-system/dist/components/index.d.ts +1 -1
  56. package/node_modules/@poe-code/design-system/dist/components/index.js +1 -1
  57. package/node_modules/@poe-code/design-system/dist/components/table.d.ts +2 -0
  58. package/node_modules/@poe-code/design-system/dist/components/table.js +82 -5
  59. package/node_modules/@poe-code/design-system/dist/components/template.d.ts +4 -0
  60. package/node_modules/@poe-code/design-system/dist/components/template.js +198 -32
  61. package/node_modules/@poe-code/design-system/dist/components/text.js +29 -5
  62. package/node_modules/@poe-code/design-system/dist/dashboard/ansi.d.ts +2 -2
  63. package/node_modules/@poe-code/design-system/dist/dashboard/ansi.js +77 -32
  64. package/node_modules/@poe-code/design-system/dist/dashboard/buffer.js +28 -5
  65. package/node_modules/@poe-code/design-system/dist/dashboard/components/output-pane.js +45 -28
  66. package/node_modules/@poe-code/design-system/dist/dashboard/terminal-width.d.ts +4 -0
  67. package/node_modules/@poe-code/design-system/dist/dashboard/terminal-width.js +71 -0
  68. package/node_modules/@poe-code/design-system/dist/dashboard/types.d.ts +1 -0
  69. package/node_modules/@poe-code/design-system/dist/explorer/events.d.ts +6 -0
  70. package/node_modules/@poe-code/design-system/dist/explorer/reducer.js +32 -10
  71. package/node_modules/@poe-code/design-system/dist/explorer/render/detail.js +3 -0
  72. package/node_modules/@poe-code/design-system/dist/explorer/runtime.js +57 -6
  73. package/node_modules/@poe-code/design-system/dist/explorer/state.d.ts +1 -0
  74. package/node_modules/@poe-code/design-system/dist/explorer/state.js +12 -15
  75. package/node_modules/@poe-code/design-system/dist/index.d.ts +3 -1
  76. package/node_modules/@poe-code/design-system/dist/index.js +2 -1
  77. package/node_modules/@poe-code/design-system/dist/prompts/primitives/intro.js +2 -1
  78. package/node_modules/@poe-code/design-system/dist/prompts/primitives/log.js +8 -5
  79. package/node_modules/@poe-code/design-system/dist/prompts/primitives/note.js +1 -1
  80. package/node_modules/@poe-code/design-system/dist/static/menu.js +8 -2
  81. package/node_modules/@poe-code/design-system/dist/static/spinner.js +10 -4
  82. package/node_modules/@poe-code/design-system/dist/terminal-markdown/parser/frontmatter.js +9 -2
  83. package/node_modules/@poe-code/design-system/dist/terminal-markdown/renderer.js +19 -2
  84. package/node_modules/@poe-code/design-system/package.json +2 -1
  85. package/node_modules/@poe-code/process-runner/dist/docker/docker-execution-env.js +244 -110
  86. package/node_modules/@poe-code/process-runner/dist/docker/docker-runner.js +16 -4
  87. package/node_modules/@poe-code/process-runner/dist/host/host-execution-env.js +3 -2
  88. package/node_modules/@poe-code/process-runner/dist/host/host-runner.js +16 -1
  89. package/node_modules/@poe-code/process-runner/dist/index.d.ts +1 -0
  90. package/node_modules/@poe-code/process-runner/dist/index.js +1 -0
  91. package/node_modules/@poe-code/process-runner/dist/testing/mock-runner.js +30 -8
  92. package/node_modules/@poe-code/process-runner/dist/types.d.ts +3 -0
  93. package/node_modules/@poe-code/process-runner/dist/workspace-transfer.d.ts +57 -0
  94. package/node_modules/@poe-code/process-runner/dist/workspace-transfer.js +484 -0
  95. package/node_modules/@poe-code/process-runner/package.json +1 -1
  96. package/node_modules/@poe-code/task-list/README.md +0 -2
  97. package/node_modules/@poe-code/task-list/dist/backends/gh-issues-client.js +3 -0
  98. package/node_modules/@poe-code/task-list/dist/backends/gh-issues-sync.js +89 -59
  99. package/node_modules/@poe-code/task-list/dist/backends/gh-issues.d.ts +9 -3
  100. package/node_modules/@poe-code/task-list/dist/backends/gh-issues.js +460 -99
  101. package/node_modules/@poe-code/task-list/dist/backends/markdown-dir.js +156 -154
  102. package/node_modules/@poe-code/task-list/dist/backends/utils.d.ts +2 -0
  103. package/node_modules/@poe-code/task-list/dist/backends/utils.js +79 -0
  104. package/node_modules/@poe-code/task-list/dist/backends/yaml-file.js +120 -132
  105. package/node_modules/@poe-code/task-list/dist/index.d.ts +3 -1
  106. package/node_modules/@poe-code/task-list/dist/index.js +2 -0
  107. package/node_modules/@poe-code/task-list/dist/move.d.ts +2 -0
  108. package/node_modules/@poe-code/task-list/dist/move.js +215 -0
  109. package/node_modules/@poe-code/task-list/dist/open.js +3 -4
  110. package/node_modules/@poe-code/task-list/dist/state-machine.js +3 -1
  111. package/node_modules/@poe-code/task-list/dist/state.js +9 -0
  112. package/node_modules/@poe-code/task-list/dist/types.d.ts +48 -13
  113. package/node_modules/@poe-code/task-list/package.json +1 -2
  114. package/node_modules/auth-store/dist/create-secret-store.js +4 -1
  115. package/node_modules/auth-store/dist/encrypted-file-store.d.ts +7 -0
  116. package/node_modules/auth-store/dist/encrypted-file-store.js +69 -7
  117. package/node_modules/auth-store/dist/index.d.ts +1 -1
  118. package/node_modules/auth-store/dist/keychain-store.d.ts +4 -1
  119. package/node_modules/auth-store/dist/keychain-store.js +18 -16
  120. package/node_modules/auth-store/dist/provider-store.d.ts +5 -1
  121. package/node_modules/auth-store/dist/provider-store.js +55 -7
  122. package/node_modules/auth-store/dist/types.d.ts +3 -1
  123. package/node_modules/auth-store/package.json +2 -1
  124. package/node_modules/mcp-oauth/dist/client/default-oauth-client-provider.js +46 -15
  125. package/node_modules/mcp-oauth/dist/client/loopback-authorization.js +49 -12
  126. package/node_modules/mcp-oauth/dist/client/token-endpoint.js +6 -1
  127. package/node_modules/mcp-oauth/dist/server/jwks-token-verifier.js +1 -1
  128. package/node_modules/mcp-oauth/package.json +1 -0
  129. package/node_modules/tiny-mcp-client/.turbo/turbo-build.log +1 -1
  130. package/node_modules/tiny-mcp-client/dist/internal.d.ts +8 -4
  131. package/node_modules/tiny-mcp-client/dist/internal.js +237 -67
  132. package/node_modules/tiny-mcp-client/dist/oauth-discovery.d.ts +1 -1
  133. package/node_modules/tiny-mcp-client/dist/oauth-discovery.js +4 -7
  134. package/node_modules/tiny-mcp-client/package.json +2 -1
  135. package/node_modules/tiny-mcp-client/src/http-oauth.integration.test.ts +1 -1
  136. package/node_modules/tiny-mcp-client/src/http-oauth.test.ts +46 -0
  137. package/node_modules/tiny-mcp-client/src/internal.ts +279 -77
  138. package/node_modules/tiny-mcp-client/src/mcp-client-tiny-stdio-test-server-tools.test.ts +1 -1
  139. package/node_modules/tiny-mcp-client/src/oauth-discovery.ts +5 -10
  140. package/node_modules/tiny-mcp-client/src/transports.test.ts +588 -6
  141. package/package.json +10 -12
  142. package/node_modules/@poe-code/file-lock/README.md +0 -52
  143. package/node_modules/@poe-code/file-lock/dist/index.d.ts +0 -1
  144. package/node_modules/@poe-code/file-lock/dist/index.js +0 -1
  145. package/node_modules/@poe-code/file-lock/dist/lock.d.ts +0 -27
  146. package/node_modules/@poe-code/file-lock/dist/lock.js +0 -203
  147. package/node_modules/@poe-code/file-lock/package.json +0 -23
@@ -29,11 +29,14 @@ const CREATE_STATUS_FIELD_MUTATION = `mutation CreateStatusField($input: CreateP
29
29
  }
30
30
  }
31
31
  }`;
32
- const CREATE_STATUS_OPTION_MUTATION = `mutation CreateStatusOption($input: CreateProjectV2SingleSelectFieldOptionInput!) {
33
- createProjectV2SingleSelectFieldOption(input: $input) {
34
- singleSelectFieldOption {
35
- id
36
- name
32
+ const UPDATE_STATUS_FIELD_OPTIONS_MUTATION = `mutation UpdateStatusFieldOptions($input: UpdateProjectV2FieldInput!) {
33
+ updateProjectV2Field(input: $input) {
34
+ projectV2Field {
35
+ ... on ProjectV2SingleSelectField {
36
+ id
37
+ name
38
+ options { id name color description }
39
+ }
37
40
  }
38
41
  }
39
42
  }`;
@@ -49,11 +52,12 @@ export class GhProjectSyncError extends Error {
49
52
  }
50
53
  export async function verifyGhProject(opts) {
51
54
  const client = resolveGhClient(opts);
52
- const target = `project:${opts.owner}/${opts.number}`;
53
- const variables = {
54
- owner: opts.owner,
55
- number: opts.number
56
- };
55
+ const lookup = await lookupProject(client, opts.owner, opts.number);
56
+ return buildVerifyReport(lookup, opts);
57
+ }
58
+ async function lookupProject(client, owner, number) {
59
+ const target = `project:${owner}/${number}`;
60
+ const variables = { owner, number };
57
61
  let project;
58
62
  try {
59
63
  const organizationResult = await client.graphql(PROJECT_ORGANIZATION_QUERY, variables);
@@ -71,7 +75,13 @@ export async function verifyGhProject(opts) {
71
75
  message: "lookup_failed"
72
76
  });
73
77
  }
74
- if (project === null) {
78
+ return {
79
+ project,
80
+ statusField: project === null ? null : selectStatusField(project)
81
+ };
82
+ }
83
+ function buildVerifyReport(lookup, opts) {
84
+ if (lookup.project === null) {
75
85
  return {
76
86
  ok: false,
77
87
  project: null,
@@ -81,12 +91,11 @@ export async function verifyGhProject(opts) {
81
91
  missingOptions: opts.requiredStates
82
92
  };
83
93
  }
84
- const statusField = selectStatusField(project);
85
- if (statusField === null) {
94
+ if (lookup.statusField === null) {
86
95
  return {
87
96
  ok: false,
88
97
  project: {
89
- id: project.id,
98
+ id: lookup.project.id,
90
99
  number: opts.number,
91
100
  owner: opts.owner
92
101
  },
@@ -96,17 +105,17 @@ export async function verifyGhProject(opts) {
96
105
  missingOptions: opts.requiredStates
97
106
  };
98
107
  }
99
- const options = statusField.options.map((option) => option.name);
108
+ const options = lookup.statusField.options.map((option) => option.name);
100
109
  const missingOptions = opts.requiredStates.filter((state) => !options.includes(state));
101
110
  return {
102
111
  ok: missingOptions.length === 0,
103
112
  project: {
104
- id: project.id,
113
+ id: lookup.project.id,
105
114
  number: opts.number,
106
115
  owner: opts.owner
107
116
  },
108
117
  statusField: {
109
- id: statusField.id,
118
+ id: lookup.statusField.id,
110
119
  options
111
120
  },
112
121
  missingProject: false,
@@ -116,47 +125,52 @@ export async function verifyGhProject(opts) {
116
125
  }
117
126
  export async function syncGhProject(opts) {
118
127
  const client = resolveGhClient(opts);
119
- const verified = await verifyGhProject({ ...opts, client });
128
+ let lookup = await lookupProject(client, opts.owner, opts.number);
129
+ let resolvedNumber = opts.number;
120
130
  const created = [];
121
- if (verified.ok) {
122
- return {
123
- ...verified,
124
- created,
125
- updated: []
126
- };
127
- }
128
- let project = verified.project;
129
- let statusField = verified.statusField;
130
- let missingOptions = [...verified.missingOptions];
131
- if (project === null) {
132
- project = await createProject(client, opts);
131
+ if (lookup.project === null) {
132
+ const newProject = await createProject(client, opts);
133
133
  created.push("project");
134
- statusField = null;
135
- missingOptions = [...opts.requiredStates];
134
+ resolvedNumber = newProject.number;
135
+ // Re-look up against the new project number so we can pick up any
136
+ // auto-created Status field (GitHub adds one by default).
137
+ lookup = await lookupProject(client, opts.owner, resolvedNumber);
136
138
  }
139
+ if (lookup.project === null) {
140
+ throw new GhProjectSyncError({
141
+ op: "createProject",
142
+ target: `${opts.owner}/${opts.number}`,
143
+ message: "project was not found after creation"
144
+ });
145
+ }
146
+ let statusField = lookup.statusField;
137
147
  if (statusField === null) {
138
- const createdStatusField = await createStatusField(client, project.id);
139
- statusField = createdStatusField;
148
+ statusField = await createStatusField(client, lookup.project.id);
140
149
  created.push("field");
141
- missingOptions = opts.requiredStates.filter((state) => !createdStatusField.options.includes(state));
142
150
  }
143
- if (missingOptions.length > 0) {
144
- for (const optionName of missingOptions) {
145
- await createStatusOption(client, statusField.id, optionName);
146
- created.push(`option:${optionName}`);
151
+ const existingNames = new Set(statusField.options.map((option) => option.name));
152
+ const missingOptionNames = opts.requiredStates.filter((state) => !existingNames.has(state));
153
+ if (missingOptionNames.length > 0) {
154
+ statusField = await addStatusOptions(client, statusField, missingOptionNames);
155
+ for (const name of missingOptionNames) {
156
+ created.push(`option:${name}`);
147
157
  }
148
- statusField = {
149
- id: statusField.id,
150
- options: [...statusField.options, ...missingOptions]
151
- };
152
- missingOptions = [];
153
158
  }
159
+ const optionNames = statusField.options.map((option) => option.name);
160
+ const missingOptions = opts.requiredStates.filter((state) => !optionNames.includes(state));
154
161
  return {
155
- ok: statusField !== null && missingOptions.length === 0,
156
- project,
157
- statusField,
162
+ ok: missingOptions.length === 0,
163
+ project: {
164
+ id: lookup.project.id,
165
+ number: resolvedNumber,
166
+ owner: opts.owner
167
+ },
168
+ statusField: {
169
+ id: statusField.id,
170
+ options: optionNames
171
+ },
158
172
  missingProject: false,
159
- missingStatusField: statusField === null,
173
+ missingStatusField: false,
160
174
  missingOptions,
161
175
  created,
162
176
  updated: []
@@ -222,10 +236,7 @@ async function createStatusField(client, projectId) {
222
236
  if (!isStatusField(field)) {
223
237
  throw new Error("createProjectV2Field returned no Status field");
224
238
  }
225
- return {
226
- id: field.id,
227
- options: field.options.map((option) => option.name)
228
- };
239
+ return field;
229
240
  }
230
241
  catch (error) {
231
242
  throw new GhProjectSyncError({
@@ -236,20 +247,37 @@ async function createStatusField(client, projectId) {
236
247
  });
237
248
  }
238
249
  }
239
- async function createStatusOption(client, fieldId, name) {
250
+ async function addStatusOptions(client, field, missingNames) {
251
+ const singleSelectOptions = [
252
+ ...field.options.map((option) => ({
253
+ id: option.id,
254
+ name: option.name,
255
+ color: option.color ?? "GRAY",
256
+ description: option.description ?? ""
257
+ })),
258
+ ...missingNames.map((name) => ({
259
+ name,
260
+ color: "GRAY",
261
+ description: ""
262
+ }))
263
+ ];
240
264
  try {
241
- await client.graphql(CREATE_STATUS_OPTION_MUTATION, {
265
+ const result = await client.graphql(UPDATE_STATUS_FIELD_OPTIONS_MUTATION, {
242
266
  input: {
243
- fieldId,
244
- name,
245
- color: "GRAY"
267
+ fieldId: field.id,
268
+ singleSelectOptions
246
269
  }
247
270
  });
271
+ const updated = result.updateProjectV2Field?.projectV2Field;
272
+ if (!isStatusField(updated)) {
273
+ throw new Error("updateProjectV2Field returned no Status field");
274
+ }
275
+ return updated;
248
276
  }
249
277
  catch (error) {
250
278
  throw new GhProjectSyncError({
251
279
  op: "createOption",
252
- target: name,
280
+ target: missingNames.join(","),
253
281
  cause: error,
254
282
  message: errorMessage(error)
255
283
  });
@@ -295,7 +323,9 @@ function isStatusOption(value) {
295
323
  "id" in value &&
296
324
  typeof value.id === "string" &&
297
325
  "name" in value &&
298
- typeof value.name === "string");
326
+ typeof value.name === "string" &&
327
+ (!("color" in value) || typeof value.color === "string") &&
328
+ (!("description" in value) || typeof value.description === "string"));
299
329
  }
300
330
  function isStatusField(value) {
301
331
  return (typeof value === "object" &&
@@ -1,12 +1,18 @@
1
+ import { type StateMachineDef } from "../state-machine.js";
1
2
  import type { TaskDefaults, TaskList } from "../types.js";
2
- export declare const PROJECT_ORGANIZATION_QUERY = "query Project($owner: String!, $number: Int!) {\n organization(login: $owner) {\n projectV2(number: $number) {\n id\n title\n field(name: \"Status\") {\n ... on ProjectV2SingleSelectField {\n id\n name\n options { id name }\n }\n }\n fields(first: 100) {\n nodes {\n ... on ProjectV2SingleSelectField {\n id\n name\n options { id name }\n }\n }\n }\n }\n }\n}";
3
- export declare const PROJECT_USER_QUERY = "query Project($owner: String!, $number: Int!) {\n user(login: $owner) {\n projectV2(number: $number) {\n id\n title\n field(name: \"Status\") {\n ... on ProjectV2SingleSelectField {\n id\n name\n options { id name }\n }\n }\n fields(first: 100) {\n nodes {\n ... on ProjectV2SingleSelectField {\n id\n name\n options { id name }\n }\n }\n }\n }\n }\n}";
3
+ export declare const PROJECT_ORGANIZATION_QUERY = "query Project($owner: String!, $number: Int!) {\n organization(login: $owner) {\n projectV2(number: $number) {\n id\n title\n field(name: \"Status\") {\n ... on ProjectV2SingleSelectField {\n id\n name\n options { id name color description }\n }\n }\n fields(first: 100) {\n nodes {\n ... on ProjectV2SingleSelectField {\n id\n name\n options { id name color description }\n }\n }\n }\n }\n }\n}";
4
+ export declare const PROJECT_USER_QUERY = "query Project($owner: String!, $number: Int!) {\n user(login: $owner) {\n projectV2(number: $number) {\n id\n title\n field(name: \"Status\") {\n ... on ProjectV2SingleSelectField {\n id\n name\n options { id name color description }\n }\n }\n fields(first: 100) {\n nodes {\n ... on ProjectV2SingleSelectField {\n id\n name\n options { id name color description }\n }\n }\n }\n }\n }\n}";
4
5
  export interface GhIssuesBackendDeps {
5
6
  repo: string;
6
- project: {
7
+ project?: {
7
8
  owner: string;
8
9
  number: number;
9
10
  };
11
+ filter?: string;
12
+ state?: {
13
+ labelPrefix?: string;
14
+ };
15
+ stateMachine?: StateMachineDef;
10
16
  defaults: Required<TaskDefaults>;
11
17
  token: string;
12
18
  endpoint: string;