@guildai/cli 0.10.0 → 0.12.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 (203) hide show
  1. package/dist/auth-CRMO5O3N.js +29 -0
  2. package/dist/auth-CRMO5O3N.js.map +7 -0
  3. package/dist/chat-5VX2WJH2.js +303 -0
  4. package/dist/chat-5VX2WJH2.js.map +7 -0
  5. package/dist/chat-SIKDYZQK.js +31 -0
  6. package/dist/chat-SIKDYZQK.js.map +7 -0
  7. package/dist/chunk-56YCMGL3.js +522 -0
  8. package/dist/chunk-56YCMGL3.js.map +7 -0
  9. package/dist/chunk-6EX6E7WP.js +7042 -0
  10. package/dist/chunk-6EX6E7WP.js.map +7 -0
  11. package/dist/chunk-B7VAF5UG.js +532 -0
  12. package/dist/chunk-B7VAF5UG.js.map +7 -0
  13. package/dist/chunk-DOIYVBNY.js +3057 -0
  14. package/dist/chunk-DOIYVBNY.js.map +7 -0
  15. package/dist/chunk-ENKEEJ45.js +17 -0
  16. package/dist/chunk-ENKEEJ45.js.map +7 -0
  17. package/dist/chunk-IBRKVGMZ.js +97041 -0
  18. package/dist/chunk-IBRKVGMZ.js.map +7 -0
  19. package/dist/chunk-LFMQJOKC.js +19778 -0
  20. package/dist/chunk-LFMQJOKC.js.map +7 -0
  21. package/dist/chunk-M347HP6M.js +22896 -0
  22. package/dist/chunk-M347HP6M.js.map +7 -0
  23. package/dist/chunk-OYQ476FQ.js +44 -0
  24. package/dist/chunk-OYQ476FQ.js.map +7 -0
  25. package/dist/chunk-PNCUR4OB.js +257 -0
  26. package/dist/chunk-PNCUR4OB.js.map +7 -0
  27. package/dist/chunk-RIG2HZWM.js +317 -0
  28. package/dist/chunk-RIG2HZWM.js.map +7 -0
  29. package/dist/chunk-SPZPZXUN.js +826 -0
  30. package/dist/chunk-SPZPZXUN.js.map +7 -0
  31. package/dist/chunk-VVSOU6ON.js +53 -0
  32. package/dist/chunk-VVSOU6ON.js.map +7 -0
  33. package/dist/chunk-X3ADGWOF.js +3643 -0
  34. package/dist/chunk-X3ADGWOF.js.map +7 -0
  35. package/dist/commands/agent/logs.d.ts +3 -0
  36. package/dist/commands/setup.d.ts +16 -0
  37. package/dist/commands/skill/create.d.ts +3 -0
  38. package/dist/commands/skill/get.d.ts +3 -0
  39. package/dist/commands/skill/list.d.ts +3 -0
  40. package/dist/commands/skill/update.d.ts +3 -0
  41. package/dist/commands/skill/version/create.d.ts +3 -0
  42. package/dist/commands/skill/version/get.d.ts +3 -0
  43. package/dist/commands/skill/version/list.d.ts +3 -0
  44. package/dist/devtools-AO7YSDOD.js +67 -0
  45. package/dist/devtools-AO7YSDOD.js.map +7 -0
  46. package/dist/dist-4CBK6X5H.js +1566 -0
  47. package/dist/dist-4CBK6X5H.js.map +7 -0
  48. package/dist/esm-FRAVZP4J.js +13 -0
  49. package/dist/esm-FRAVZP4J.js.map +7 -0
  50. package/dist/execa-XQMWSABC.js +35 -0
  51. package/dist/execa-XQMWSABC.js.map +7 -0
  52. package/dist/index.js +8231 -253
  53. package/dist/index.js.map +7 -0
  54. package/dist/lib/api-types.d.ts +44 -0
  55. package/dist/lib/auth.d.ts +1 -1
  56. package/dist/lib/config.d.ts +9 -0
  57. package/dist/lib/errors.d.ts +1 -1
  58. package/dist/lib/output-mode.d.ts +9 -2
  59. package/dist/lib/output.d.ts +17 -1
  60. package/dist/lib/session-events.d.ts +14 -3
  61. package/dist/lib/session-polling.d.ts +24 -1
  62. package/dist/lib/session-resume.d.ts +15 -1
  63. package/dist/lib/stdin.d.ts +5 -1
  64. package/dist/lib/websocket-client.d.ts +46 -0
  65. package/dist/open-RF4X5MOP.js +13 -0
  66. package/dist/open-RF4X5MOP.js.map +7 -0
  67. package/dist/server-JYVH64FD.js +27659 -0
  68. package/dist/server-JYVH64FD.js.map +7 -0
  69. package/dist/test-SNIYRJ32.js +692 -0
  70. package/dist/test-SNIYRJ32.js.map +7 -0
  71. package/docs/skills/codex-agent-dev.md +2 -2
  72. package/package.json +8 -12
  73. package/dist/commands/agent/chat.js +0 -278
  74. package/dist/commands/agent/clone.js +0 -116
  75. package/dist/commands/agent/code.js +0 -87
  76. package/dist/commands/agent/fork.js +0 -218
  77. package/dist/commands/agent/get.js +0 -37
  78. package/dist/commands/agent/grep.js +0 -107
  79. package/dist/commands/agent/init.js +0 -390
  80. package/dist/commands/agent/list.js +0 -110
  81. package/dist/commands/agent/owners.js +0 -74
  82. package/dist/commands/agent/publish.js +0 -91
  83. package/dist/commands/agent/pull.js +0 -198
  84. package/dist/commands/agent/revalidate.js +0 -56
  85. package/dist/commands/agent/save.js +0 -346
  86. package/dist/commands/agent/search.js +0 -61
  87. package/dist/commands/agent/tags/add.js +0 -73
  88. package/dist/commands/agent/tags/list.js +0 -43
  89. package/dist/commands/agent/tags/remove.js +0 -84
  90. package/dist/commands/agent/tags/set.js +0 -71
  91. package/dist/commands/agent/test.js +0 -486
  92. package/dist/commands/agent/unpublish.js +0 -64
  93. package/dist/commands/agent/update.js +0 -110
  94. package/dist/commands/agent/versions.js +0 -55
  95. package/dist/commands/agent/workspaces.js +0 -54
  96. package/dist/commands/auth/login.js +0 -33
  97. package/dist/commands/auth/logout.js +0 -24
  98. package/dist/commands/auth/status.js +0 -38
  99. package/dist/commands/auth/token.js +0 -19
  100. package/dist/commands/chat.js +0 -1345
  101. package/dist/commands/config/get.js +0 -64
  102. package/dist/commands/config/list.js +0 -47
  103. package/dist/commands/config/path.js +0 -38
  104. package/dist/commands/config/set.js +0 -132
  105. package/dist/commands/credentials/endpoint-list.js +0 -88
  106. package/dist/commands/credentials/list.js +0 -50
  107. package/dist/commands/credentials/policy-create.js +0 -66
  108. package/dist/commands/credentials/policy-delete.js +0 -33
  109. package/dist/commands/credentials/policy-list.js +0 -45
  110. package/dist/commands/credentials/policy-update.js +0 -66
  111. package/dist/commands/doctor.js +0 -233
  112. package/dist/commands/integration/connect.js +0 -76
  113. package/dist/commands/integration/create.js +0 -298
  114. package/dist/commands/integration/get.js +0 -95
  115. package/dist/commands/integration/list.js +0 -62
  116. package/dist/commands/integration/operation/create.js +0 -164
  117. package/dist/commands/integration/operation/list.js +0 -92
  118. package/dist/commands/integration/update.js +0 -139
  119. package/dist/commands/integration/version/build.js +0 -86
  120. package/dist/commands/integration/version/create.js +0 -45
  121. package/dist/commands/integration/version/get.js +0 -72
  122. package/dist/commands/integration/version/list.js +0 -45
  123. package/dist/commands/integration/version/publish.js +0 -79
  124. package/dist/commands/integration/version/test.js +0 -104
  125. package/dist/commands/job/get-step.js +0 -40
  126. package/dist/commands/job/get.js +0 -44
  127. package/dist/commands/mcp.js +0 -34
  128. package/dist/commands/session/create.js +0 -59
  129. package/dist/commands/session/events.js +0 -56
  130. package/dist/commands/session/get.js +0 -33
  131. package/dist/commands/session/interrupt.js +0 -33
  132. package/dist/commands/session/list.js +0 -59
  133. package/dist/commands/session/send.js +0 -54
  134. package/dist/commands/session/tasks.js +0 -45
  135. package/dist/commands/setup.js +0 -230
  136. package/dist/commands/trigger/activate.js +0 -41
  137. package/dist/commands/trigger/create.js +0 -197
  138. package/dist/commands/trigger/deactivate.js +0 -41
  139. package/dist/commands/trigger/get.js +0 -33
  140. package/dist/commands/trigger/list.js +0 -57
  141. package/dist/commands/trigger/sessions.js +0 -48
  142. package/dist/commands/trigger/update.js +0 -128
  143. package/dist/commands/version.js +0 -24
  144. package/dist/commands/workspace/agent/add.js +0 -114
  145. package/dist/commands/workspace/agent/list.js +0 -78
  146. package/dist/commands/workspace/agent/remove.js +0 -78
  147. package/dist/commands/workspace/clear.js +0 -45
  148. package/dist/commands/workspace/context/edit.js +0 -107
  149. package/dist/commands/workspace/context/get.js +0 -47
  150. package/dist/commands/workspace/context/list.js +0 -51
  151. package/dist/commands/workspace/context/publish.js +0 -42
  152. package/dist/commands/workspace/create.js +0 -51
  153. package/dist/commands/workspace/current.js +0 -63
  154. package/dist/commands/workspace/get.js +0 -39
  155. package/dist/commands/workspace/list.js +0 -70
  156. package/dist/commands/workspace/select.js +0 -184
  157. package/dist/components/AgentInstallPrompt.js +0 -97
  158. package/dist/components/SplashAnimation.js +0 -321
  159. package/dist/components/TaskView.js +0 -268
  160. package/dist/lib/agent-helpers.js +0 -306
  161. package/dist/lib/alternate-screen.js +0 -59
  162. package/dist/lib/api-client.js +0 -154
  163. package/dist/lib/api-types.js +0 -10
  164. package/dist/lib/auth.js +0 -284
  165. package/dist/lib/braille-canvas.js +0 -321
  166. package/dist/lib/colors.js +0 -46
  167. package/dist/lib/config-cache.js +0 -45
  168. package/dist/lib/config.js +0 -153
  169. package/dist/lib/did-you-mean.js +0 -144
  170. package/dist/lib/errors.js +0 -375
  171. package/dist/lib/event-filter.js +0 -91
  172. package/dist/lib/generated-types.js +0 -56
  173. package/dist/lib/git.js +0 -176
  174. package/dist/lib/gk.js +0 -91
  175. package/dist/lib/guild-config.js +0 -178
  176. package/dist/lib/iap.js +0 -117
  177. package/dist/lib/integration-helpers.js +0 -38
  178. package/dist/lib/loading-messages.js +0 -72
  179. package/dist/lib/logo.js +0 -141
  180. package/dist/lib/lottie-serverside.js +0 -181
  181. package/dist/lib/markdown.js +0 -38
  182. package/dist/lib/npmrc.js +0 -59
  183. package/dist/lib/output-mode.js +0 -33
  184. package/dist/lib/output.js +0 -591
  185. package/dist/lib/owner-helpers.js +0 -112
  186. package/dist/lib/polling.js +0 -76
  187. package/dist/lib/progress.js +0 -324
  188. package/dist/lib/session-events-fetch.js +0 -25
  189. package/dist/lib/session-events.js +0 -112
  190. package/dist/lib/session-polling.js +0 -160
  191. package/dist/lib/session-resume.js +0 -96
  192. package/dist/lib/spinners.js +0 -770
  193. package/dist/lib/splash.js +0 -41
  194. package/dist/lib/stdin.js +0 -84
  195. package/dist/lib/svg-to-braille.js +0 -76
  196. package/dist/lib/table.js +0 -59
  197. package/dist/lib/update-check.js +0 -65
  198. package/dist/lib/validate-input-schema.js +0 -208
  199. package/dist/lib/version-helpers.js +0 -121
  200. package/dist/lib/workspace-helpers.js +0 -49
  201. package/dist/mcp/resources.js +0 -67
  202. package/dist/mcp/server.js +0 -64
  203. package/dist/mcp/tools.js +0 -753
@@ -1,112 +0,0 @@
1
- // Copyright 2026 Guild.ai
2
- // SPDX-License-Identifier: Apache-2.0
3
- /**
4
- * Owner resolution helper for agent creation commands.
5
- *
6
- * Resolves the owner (user or organization) to use when creating agents.
7
- * Used by `guild agent init` and `guild agent fork`.
8
- *
9
- * Resolution priority:
10
- * 1. --owner flag (explicit)
11
- * 2. GUILD_OWNER_ID environment variable
12
- * 3. default_owner from ~/.guild/config.json
13
- * 4. Fetch user + orgs from API:
14
- * - No orgs + non-interactive → use current user (single-account, stated explicitly)
15
- * - No orgs + interactive → prompt with personal account as only choice
16
- * - Has orgs + interactive → prompt to select from all accounts
17
- * - Has orgs + non-interactive → error: require --owner flag
18
- */
19
- import inquirer from 'inquirer';
20
- import { loadGlobalConfig } from './guild-config.js';
21
- import { debug } from './errors.js';
22
- /**
23
- * Look up an owner by ID or name against the current user and their organizations.
24
- * Returns the resolved owner, or undefined if no match is found.
25
- */
26
- export async function lookupOwner(client, val) {
27
- const me = await client.get('/me');
28
- if (me.id === val || me.name === val) {
29
- return { id: me.id, name: me.name, type: 'user' };
30
- }
31
- const orgs = await client.fetchAll('/me/organizations');
32
- const org = orgs.find((o) => o.id === val || o.name === val);
33
- if (org) {
34
- return { id: org.id, name: org.name, type: 'organization' };
35
- }
36
- return undefined;
37
- }
38
- export async function resolveOwnerId(options) {
39
- const { ownerFlag, client, interactive, requireExplicitOwner = false } = options;
40
- // Priority 1: --owner flag
41
- if (ownerFlag) {
42
- debug('Using owner from --owner flag: %s', ownerFlag);
43
- const match = await lookupOwner(client, ownerFlag);
44
- if (match)
45
- return match;
46
- // Not found in user or orgs — pass through and let backend validate
47
- return { id: ownerFlag, name: ownerFlag, type: 'organization' };
48
- }
49
- // Priority 2: GUILD_OWNER_ID environment variable
50
- if (process.env.GUILD_OWNER_ID) {
51
- debug('Using owner from GUILD_OWNER_ID env var: %s', process.env.GUILD_OWNER_ID);
52
- const match = await lookupOwner(client, process.env.GUILD_OWNER_ID);
53
- if (match)
54
- return match;
55
- // Not found in user or orgs — pass through and let backend validate
56
- return {
57
- id: process.env.GUILD_OWNER_ID,
58
- name: process.env.GUILD_OWNER_ID,
59
- type: 'organization',
60
- };
61
- }
62
- // Priority 3: default_owner from config
63
- const globalConfig = await loadGlobalConfig();
64
- if (globalConfig?.default_owner) {
65
- debug('Using owner from global config: %s', globalConfig.default_owner);
66
- const match = await lookupOwner(client, globalConfig.default_owner);
67
- if (match)
68
- return match;
69
- const name = globalConfig.default_owner_name || globalConfig.default_owner;
70
- return { id: globalConfig.default_owner, name, type: 'organization' };
71
- }
72
- // Priority 4: Fetch user + orgs
73
- const me = await client.get('/me');
74
- const orgs = await client.fetchAll('/me/organizations');
75
- // No orgs + non-interactive → use current user (single account, stated explicitly by caller)
76
- if (orgs.length === 0 && !interactive) {
77
- debug('No organizations found, using current user as owner');
78
- return { id: me.id, name: me.name, type: 'user' };
79
- }
80
- // Has orgs + non-interactive
81
- if (orgs.length > 0 && !interactive) {
82
- if (requireExplicitOwner) {
83
- debug('Non-interactive mode with multiple accounts available, requiring --owner');
84
- throw new Error('Owner is required in non-interactive mode when multiple accounts are available.\n\n' +
85
- 'Use --owner <name-or-id> to specify an owner, or set a default:\n' +
86
- ' guild config set default_owner <name-or-id>');
87
- }
88
- debug('Multiple accounts available, defaulting to current user');
89
- return { id: me.id, name: me.name, type: 'user' };
90
- }
91
- // Interactive → prompt (always, even with single account)
92
- const choices = [
93
- {
94
- name: `${me.name} (personal)`,
95
- value: { id: me.id, name: me.name, type: 'user' },
96
- },
97
- ...orgs.map((org) => ({
98
- name: org.name,
99
- value: { id: org.id, name: org.name, type: 'organization' },
100
- })),
101
- ];
102
- const { owner } = await inquirer.prompt([
103
- {
104
- type: 'list',
105
- name: 'owner',
106
- message: 'Select owner for this agent:',
107
- choices,
108
- },
109
- ]);
110
- return owner;
111
- }
112
- //# sourceMappingURL=owner-helpers.js.map
@@ -1,76 +0,0 @@
1
- // Copyright 2026 Guild.ai
2
- // SPDX-License-Identifier: Apache-2.0
3
- import { GuildAPIClient } from './api-client.js';
4
- import { createSpinner } from './progress.js';
5
- /**
6
- * Poll an endpoint until a condition is met or timeout occurs
7
- *
8
- * @example
9
- * ```typescript
10
- * const result = await pollUntilComplete({
11
- * resourceId: agentId,
12
- * endpoint: `/agents/${agentId}`,
13
- * isComplete: (response) => response.status === 'READY',
14
- * message: 'Waiting for agent initialization...',
15
- * successMessage: 'Agent initialization complete'
16
- * });
17
- *
18
- * if (result.success) {
19
- * console.log('Agent is ready:', result.response);
20
- * }
21
- * ```
22
- */
23
- export async function pollUntilComplete(options) {
24
- const { endpoint, isComplete, message = 'Waiting for operation to complete...', maxAttempts = 60, delayMs = 1000, successMessage = 'Operation complete', timeoutMessage = 'Operation timed out', onPoll, } = options;
25
- const client = new GuildAPIClient();
26
- const spinner = createSpinner(message);
27
- spinner.start();
28
- let attempts = 0;
29
- let lastResponse;
30
- for (attempts = 1; attempts <= maxAttempts; attempts++) {
31
- await new Promise((resolve) => setTimeout(resolve, delayMs));
32
- try {
33
- const response = await client.get(endpoint);
34
- lastResponse = response;
35
- if (isComplete(response)) {
36
- spinner.succeed(successMessage);
37
- return {
38
- success: true,
39
- response,
40
- attempts,
41
- };
42
- }
43
- // Update spinner with progress — prefer onPoll text when available
44
- let spinnerText = null;
45
- if (onPoll) {
46
- try {
47
- spinnerText = await onPoll(response, attempts);
48
- }
49
- catch {
50
- // Silently ignore step-fetch errors; fall back to default text
51
- }
52
- }
53
- spinner.text = spinnerText ?? `${message} (${attempts}/${maxAttempts})`;
54
- }
55
- catch {
56
- // If we can't fetch the resource, continue polling
57
- // Only fail on the last attempt
58
- if (attempts === maxAttempts) {
59
- spinner.warn('Could not verify operation status');
60
- return {
61
- success: false,
62
- response: lastResponse,
63
- attempts,
64
- };
65
- }
66
- }
67
- }
68
- // Timed out
69
- spinner.warn(timeoutMessage);
70
- return {
71
- success: false,
72
- response: lastResponse,
73
- attempts,
74
- };
75
- }
76
- //# sourceMappingURL=polling.js.map
@@ -1,324 +0,0 @@
1
- // Copyright 2026 Guild.ai
2
- // SPDX-License-Identifier: Apache-2.0
3
- import ora from 'ora';
4
- import chalk from 'chalk';
5
- import { brand, warn as warnColor } from './colors.js';
6
- /**
7
- * Shared progress utilities for beautiful CLI UX
8
- *
9
- * Design Philosophy:
10
- * - Beautiful for humans, parseable for agents
11
- * - Interactive mode: Elegant spinners, clear status updates
12
- * - Non-interactive mode: Structured timestamped output
13
- * - All progress goes to stderr (keeps stdout clean for JSON)
14
- * - Respects NO_COLOR environment variable
15
- * - Respects --quiet flag (suppresses stderr output)
16
- * - --json mode still shows spinners (stderr is okay, stdout stays clean)
17
- */
18
- // Detect TTY mode and color support
19
- // Check stderr since spinners write to stderr
20
- const isTTY = process.stderr.isTTY || false;
21
- const useColor = !process.env.NO_COLOR;
22
- /**
23
- * Create a spinner for operations with unknown duration
24
- *
25
- * In TTY mode: Uses ora with elegant spinner animation
26
- * In non-TTY mode: Outputs timestamped messages to stderr
27
- * In quiet mode (--quiet): Returns no-op spinner (no output)
28
- *
29
- * Note: --json mode still shows spinners to stderr (use --quiet to suppress)
30
- *
31
- * @param text - Initial spinner text
32
- * @returns Spinner instance
33
- */
34
- export function createSpinner(text) {
35
- // In quiet mode (--quiet), return no-op spinner
36
- // Note: --json is NOT quiet by default (spinners to stderr are okay)
37
- const isQuiet = process.argv.includes('--quiet') || process.argv.includes('-q');
38
- if (isQuiet) {
39
- let currentText = text;
40
- return {
41
- get text() {
42
- return currentText;
43
- },
44
- set text(value) {
45
- currentText = value;
46
- },
47
- start() {
48
- // No-op
49
- },
50
- stop() {
51
- // No-op
52
- },
53
- succeed() {
54
- // No-op
55
- },
56
- fail() {
57
- // No-op
58
- },
59
- warn() {
60
- // No-op
61
- },
62
- };
63
- }
64
- if (isTTY) {
65
- // Use ora in interactive mode
66
- const spinner = ora({
67
- text,
68
- stream: process.stderr,
69
- color: useColor ? 'blue' : undefined,
70
- });
71
- return {
72
- get text() {
73
- return spinner.text;
74
- },
75
- set text(value) {
76
- spinner.text = value;
77
- },
78
- start() {
79
- spinner.start();
80
- },
81
- stop() {
82
- spinner.stop();
83
- },
84
- succeed(successText) {
85
- // Show green checkmark with dim text (like Claude Code)
86
- const textToShow = successText || spinner.text;
87
- spinner.stopAndPersist({
88
- symbol: useColor ? chalk.green('✔') : '✔',
89
- text: useColor ? chalk.dim(textToShow) : textToShow,
90
- });
91
- },
92
- fail(failText) {
93
- spinner.fail(failText);
94
- },
95
- warn(warnText) {
96
- spinner.warn(warnText);
97
- },
98
- };
99
- }
100
- else {
101
- // Fallback for non-TTY mode (CI, scripts, etc.)
102
- let currentText = text;
103
- return {
104
- get text() {
105
- return currentText;
106
- },
107
- set text(value) {
108
- currentText = value;
109
- const timestamp = new Date().toLocaleTimeString();
110
- process.stderr.write(`[${timestamp}] ${value}\n`);
111
- },
112
- start() {
113
- const timestamp = new Date().toLocaleTimeString();
114
- process.stderr.write(`[${timestamp}] ${currentText}\n`);
115
- },
116
- stop() {
117
- // No-op in non-TTY mode
118
- },
119
- succeed(successText) {
120
- const timestamp = new Date().toLocaleTimeString();
121
- const message = successText || currentText;
122
- process.stderr.write(`[${timestamp}] ${message}\n`);
123
- },
124
- fail(failText) {
125
- const timestamp = new Date().toLocaleTimeString();
126
- const message = failText || currentText;
127
- process.stderr.write(`[${timestamp}] ${message}\n`);
128
- },
129
- warn(warnText) {
130
- const timestamp = new Date().toLocaleTimeString();
131
- const message = warnText || currentText;
132
- process.stderr.write(`[${timestamp}] ${message}\n`);
133
- },
134
- };
135
- }
136
- }
137
- /**
138
- * Create a multi-step progress tracker
139
- *
140
- * Tracks progress through a known sequence of steps, showing success/failure
141
- * for each step and a final summary.
142
- *
143
- * @param steps - Array of step names
144
- * @returns Steps instance
145
- */
146
- export function createSteps(steps) {
147
- const stepStatus = new Map();
148
- // Initialize all steps as pending
149
- steps.forEach((step) => stepStatus.set(step, 'pending'));
150
- const formatStep = (step, status, details) => {
151
- let icon;
152
- let formattedIcon;
153
- switch (status) {
154
- case 'success':
155
- icon = '✓';
156
- formattedIcon = useColor ? chalk.green(icon) : icon;
157
- break;
158
- case 'fail':
159
- icon = '✗';
160
- formattedIcon = useColor ? chalk.red(icon) : icon;
161
- break;
162
- case 'warn':
163
- icon = '⚠';
164
- formattedIcon = useColor ? warnColor(icon) : icon;
165
- break;
166
- }
167
- let output = `${formattedIcon} ${step}`;
168
- if (details) {
169
- const detailColor = useColor ? chalk.dim : (text) => text;
170
- output += `\n${detailColor(` ${details}`)}`;
171
- }
172
- return output;
173
- };
174
- return {
175
- start() {
176
- // No-op for now, could show initial step list
177
- },
178
- succeed(step, details) {
179
- stepStatus.set(step, 'success');
180
- const output = formatStep(step, 'success', details);
181
- if (isTTY) {
182
- process.stderr.write(output + '\n');
183
- }
184
- else {
185
- const timestamp = new Date().toLocaleTimeString();
186
- process.stderr.write(`[${timestamp}] ${step}... done\n`);
187
- if (details) {
188
- process.stderr.write(`[${timestamp}] ${details}\n`);
189
- }
190
- }
191
- },
192
- fail(step, details) {
193
- stepStatus.set(step, 'fail');
194
- const output = formatStep(step, 'fail', details);
195
- if (isTTY) {
196
- process.stderr.write(output + '\n');
197
- }
198
- else {
199
- const timestamp = new Date().toLocaleTimeString();
200
- process.stderr.write(`[${timestamp}] ${step}... failed\n`);
201
- if (details) {
202
- process.stderr.write(`[${timestamp}] ${details}\n`);
203
- }
204
- }
205
- },
206
- warn(step, details) {
207
- stepStatus.set(step, 'warn');
208
- const output = formatStep(step, 'warn', details);
209
- if (isTTY) {
210
- process.stderr.write(output + '\n');
211
- }
212
- else {
213
- const timestamp = new Date().toLocaleTimeString();
214
- process.stderr.write(`[${timestamp}] ${step}... warning\n`);
215
- if (details) {
216
- process.stderr.write(`[${timestamp}] ${details}\n`);
217
- }
218
- }
219
- },
220
- complete(summary) {
221
- const successCount = Array.from(stepStatus.values()).filter((s) => s === 'success').length;
222
- const totalCount = stepStatus.size;
223
- const defaultSummary = `Completed (${successCount}/${totalCount} steps successful)`;
224
- const message = summary || defaultSummary;
225
- if (isTTY && useColor) {
226
- const iconColor = successCount === totalCount ? chalk.green : warnColor;
227
- process.stderr.write('\n' + iconColor('✓') + ' ' + message + '\n');
228
- }
229
- else {
230
- const timestamp = new Date().toLocaleTimeString();
231
- process.stderr.write(`[${timestamp}] ${message}\n`);
232
- }
233
- },
234
- };
235
- }
236
- /**
237
- * Formatting helpers for consistent, beautiful output
238
- */
239
- export const format = {
240
- /**
241
- * Format a success message (green checkmark + white text)
242
- */
243
- success(message) {
244
- if (isTTY && useColor) {
245
- process.stderr.write(chalk.green('✓') + ' ' + message + '\n');
246
- }
247
- else {
248
- process.stderr.write(`✓ ${message}\n`);
249
- }
250
- },
251
- /**
252
- * Format an error message (red X + text)
253
- */
254
- error(message) {
255
- if (isTTY) {
256
- const color = useColor ? chalk.red : (text) => text;
257
- process.stderr.write(color(`✗ ${message}`) + '\n');
258
- }
259
- else {
260
- process.stderr.write(`✗ ${message}\n`);
261
- }
262
- },
263
- /**
264
- * Format a warning message (yellow warning + text)
265
- */
266
- warn(message) {
267
- if (isTTY) {
268
- const color = useColor ? warnColor : (text) => text;
269
- process.stderr.write(color(`⚠ ${message}`) + '\n');
270
- }
271
- else {
272
- process.stderr.write(`⚠ ${message}\n`);
273
- }
274
- },
275
- /**
276
- * Format an info message (blue info + text)
277
- */
278
- info(message) {
279
- if (isTTY) {
280
- const color = useColor ? brand : (text) => text;
281
- process.stderr.write(color(`ℹ ${message}`) + '\n');
282
- }
283
- else {
284
- process.stderr.write(`ℹ ${message}\n`);
285
- }
286
- },
287
- /**
288
- * Format an indented detail line
289
- */
290
- detail(message) {
291
- if (isTTY) {
292
- const color = useColor ? chalk.dim : (text) => text;
293
- process.stderr.write(color(` ${message}`) + '\n');
294
- }
295
- else {
296
- process.stderr.write(` ${message}\n`);
297
- }
298
- },
299
- /**
300
- * Format a section header
301
- */
302
- section(message) {
303
- if (isTTY) {
304
- const color = useColor ? chalk.bold : (text) => text;
305
- process.stderr.write('\n' + color(message) + '\n');
306
- }
307
- else {
308
- process.stderr.write(`\n${message}\n`);
309
- }
310
- },
311
- /**
312
- * Format a code snippet
313
- */
314
- code(message) {
315
- if (isTTY) {
316
- const color = useColor ? chalk.dim : (text) => text;
317
- process.stderr.write(color(` ${message}`) + '\n');
318
- }
319
- else {
320
- process.stderr.write(` ${message}\n`);
321
- }
322
- },
323
- };
324
- //# sourceMappingURL=progress.js.map
@@ -1,25 +0,0 @@
1
- // Copyright 2026 Guild.ai
2
- // SPDX-License-Identifier: Apache-2.0
3
- /**
4
- * Fetch session events from the API.
5
- *
6
- * Uses from_id cursor so callers only fetch new events
7
- * instead of re-fetching everything on every poll cycle.
8
- */
9
- export async function fetchEvents(client, sessionId, options = {}) {
10
- const { fromId, limit = 1000 } = options;
11
- let url = `/sessions/${sessionId}/events?limit=${limit}`;
12
- if (fromId) {
13
- url += `&from_id=${fromId}`;
14
- }
15
- const response = await client.get(url);
16
- return response?.items || [];
17
- }
18
- /**
19
- * Fetch session tasks from the API.
20
- */
21
- export async function fetchTasks(client, sessionId) {
22
- const response = await client.get(`/sessions/${sessionId}/tasks?limit=1000`);
23
- return response?.items || [];
24
- }
25
- //# sourceMappingURL=session-events-fetch.js.map
@@ -1,112 +0,0 @@
1
- // Copyright 2026 Guild.ai
2
- // SPDX-License-Identifier: Apache-2.0
3
- // =============================================================================
4
- // Task Filtering
5
- // =============================================================================
6
- /**
7
- * Internal task names that should be hidden from user-facing displays.
8
- * These are coordination/UI mechanisms, not meaningful tasks to show.
9
- *
10
- * - ui_notify: Internal notification dispatch
11
- * - ui_prompt: User input prompts (shown via dedicated UI, not task panel)
12
- * - __submit__: Internal message submission
13
- * - guild_credentials_request: Credential configuration prompts (shown via dedicated UI)
14
- */
15
- export const FILTERED_TASK_NAMES = new Set([
16
- 'ui_notify',
17
- 'ui_prompt',
18
- '__submit__',
19
- 'guild_credentials_request',
20
- ]);
21
- /** Check if a task/tool name should be filtered from display */
22
- export function isFilteredTaskName(name) {
23
- return FILTERED_TASK_NAMES.has(name);
24
- }
25
- // =============================================================================
26
- // Task Utility Functions
27
- // =============================================================================
28
- /** Check if task is an agent task (has agent property) */
29
- export function isAgentTask(task) {
30
- return 'agent' in task;
31
- }
32
- /** Check if task is a tool task (has tool_name property) */
33
- export function isToolTask(task) {
34
- return 'tool_name' in task;
35
- }
36
- /** Extract display name from an agent reference */
37
- export function getAgentName(agent) {
38
- return agent?.full_name || 'assistant';
39
- }
40
- /**
41
- * Check if a task's agent matches a target agent identifier.
42
- *
43
- * Target format: "@scope/owner~name" (e.g. "@guildai/guildai~agent-builder") or simple name ("assistant")
44
- * AgentRef format: { name: "agent-builder", full_name: "guildai~agent-builder", ... }
45
- */
46
- export function matchesAgent(taskAgent, targetAgent) {
47
- if (!taskAgent)
48
- return false;
49
- // Direct name match for simple identifiers like "assistant"
50
- if (taskAgent.name === targetAgent)
51
- return true;
52
- // Normalize target to match full_name format:
53
- // 1. Strip npm scope prefix: "@scope/owner~name" -> "owner~name"
54
- // 2. Convert slash separator to tilde: "owner/name" -> "owner~name"
55
- if (taskAgent.full_name) {
56
- const normalized = targetAgent.replace(/^@[^/]+\//, '').replace('/', '~');
57
- if (taskAgent.full_name === normalized)
58
- return true;
59
- }
60
- return false;
61
- }
62
- /** Get display name for a task - agent name or tool name */
63
- export function getTaskDisplayName(task) {
64
- if (isAgentTask(task)) {
65
- return getAgentName(task.agent);
66
- }
67
- if (isToolTask(task)) {
68
- return task.tool_name;
69
- }
70
- return 'Unknown';
71
- }
72
- /** Get task type label */
73
- export function getTaskTypeLabel(task) {
74
- if (isAgentTask(task)) {
75
- return 'Agent';
76
- }
77
- if (isToolTask(task)) {
78
- return 'Tool';
79
- }
80
- return 'Task';
81
- }
82
- /** Check if event is an unfulfilled agent install request */
83
- export function isUnfulfilledAgentInstallRequest(event) {
84
- return event.type === 'agent_install_request' && !event.is_fulfilled;
85
- }
86
- /** Check if event is an unfulfilled credentials request */
87
- export function isUnfulfilledCredentialsRequest(event) {
88
- return event.type === 'credentials_request' && !event.is_fulfilled;
89
- }
90
- /** Check if an agent notification message is a transient response stream draft. */
91
- export function isResponseStreamEvent(event) {
92
- return (event.type === 'agent_notification_message' &&
93
- event.content.type === 'application/guild-response-stream');
94
- }
95
- /** Check if a response stream event carries the final generated text. */
96
- export function isDoneResponseStreamEvent(event) {
97
- return isResponseStreamEvent(event) && event.content.status === 'done';
98
- }
99
- /** Extract display text from notification content. */
100
- export function getAgentNotificationText(event) {
101
- return event.content.type === 'text' ? event.content.data : event.content.text;
102
- }
103
- /** Check if an event belongs to the root task or has no task context. */
104
- export function isRootTaskEvent(event) {
105
- const task = event.task;
106
- if (!task)
107
- return true;
108
- if ('parent_task_id' in task)
109
- return task.parent_task_id === null;
110
- return task.parent_task === null;
111
- }
112
- //# sourceMappingURL=session-events.js.map