@gopherhole/cli 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -20,7 +20,7 @@ const brand = {
20
20
  greenDark: chalk_1.default.hex('#16a34a'), // gopher-600 - emphasis
21
21
  };
22
22
  // Version
23
- const VERSION = '0.2.0';
23
+ const VERSION = '0.3.0';
24
24
  // ========== API KEY RESOLUTION ==========
25
25
  // Precedence: --api-key flag > GOPHERHOLE_API_KEY env var > .env file in cwd
26
26
  async function resolveApiKey(flagValue) {
@@ -91,6 +91,7 @@ async function askAgent(client, agentId, text) {
91
91
  const start = Date.now();
92
92
  const maxWait = 60_000;
93
93
  const poll = 1_000;
94
+ let printedQueued = false;
94
95
  while (!terminalStates.includes(current.status.state)) {
95
96
  if (current.status.state === 'input-required') {
96
97
  throw new Error('Agent requires additional input (not supported in CLI mode)');
@@ -98,6 +99,10 @@ async function askAgent(client, agentId, text) {
98
99
  if (current.status.state === 'auth-required') {
99
100
  throw new Error('Agent requires authentication — check your API key or request access');
100
101
  }
102
+ if (current.status.state === 'submitted' && !printedQueued) {
103
+ console.log(chalk_1.default.yellow('⏳ Message queued — recipient is offline. Waiting for delivery...'));
104
+ printedQueued = true;
105
+ }
101
106
  if (Date.now() - start > maxWait)
102
107
  throw new Error('Timed out waiting for agent response');
103
108
  await new Promise(r => setTimeout(r, poll));
@@ -1216,8 +1221,11 @@ program
1216
1221
  ${chalk_1.default.bold('Examples:')}
1217
1222
  $ gopherhole send echo "Hello!"
1218
1223
  $ gopherhole send agent-abc123 "What's the weather?"
1224
+ $ gopherhole send agent-abc123 "Free now?" --ttl 0 # fail if offline
1225
+ $ gopherhole send agent-abc123 "Review this" --ttl 3600 # queue up to 1h
1219
1226
  `)
1220
- .action(async (agentId, message) => {
1227
+ .option('--ttl <seconds>', 'Message time-to-live in seconds (0 = no queue, omit = 30 day default)', parseInt)
1228
+ .action(async (agentId, message, cmdOpts) => {
1221
1229
  const sessionId = config.get('sessionId');
1222
1230
  if (!sessionId) {
1223
1231
  console.log(chalk_1.default.yellow('Not logged in.'));
@@ -1238,7 +1246,10 @@ ${chalk_1.default.bold('Examples:')}
1238
1246
  method: 'SendMessage',
1239
1247
  params: {
1240
1248
  message: { role: 'user', parts: [{ kind: 'text', text: message }] },
1241
- configuration: { agentId },
1249
+ configuration: {
1250
+ agentId,
1251
+ ...(cmdOpts.ttl !== undefined ? { 'x-ttl': cmdOpts.ttl } : {}),
1252
+ },
1242
1253
  },
1243
1254
  id: 1,
1244
1255
  }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gopherhole/cli",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "GopherHole CLI - Connect AI agents to the world",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
package/src/index.ts CHANGED
@@ -20,7 +20,7 @@ const brand = {
20
20
  };
21
21
 
22
22
  // Version
23
- const VERSION = '0.2.0';
23
+ const VERSION = '0.3.0';
24
24
 
25
25
  // ========== API KEY RESOLUTION ==========
26
26
  // Precedence: --api-key flag > GOPHERHOLE_API_KEY env var > .env file in cwd
@@ -96,6 +96,7 @@ async function askAgent(client: A2AClient, agentId: string, text: string): Promi
96
96
  const maxWait = 60_000;
97
97
  const poll = 1_000;
98
98
 
99
+ let printedQueued = false;
99
100
  while (!terminalStates.includes(current.status.state)) {
100
101
  if (current.status.state === 'input-required') {
101
102
  throw new Error('Agent requires additional input (not supported in CLI mode)');
@@ -103,6 +104,10 @@ async function askAgent(client: A2AClient, agentId: string, text: string): Promi
103
104
  if (current.status.state === 'auth-required') {
104
105
  throw new Error('Agent requires authentication — check your API key or request access');
105
106
  }
107
+ if (current.status.state === 'submitted' && !printedQueued) {
108
+ console.log(chalk.yellow('⏳ Message queued — recipient is offline. Waiting for delivery...'));
109
+ printedQueued = true;
110
+ }
106
111
  if (Date.now() - start > maxWait) throw new Error('Timed out waiting for agent response');
107
112
  await new Promise(r => setTimeout(r, poll));
108
113
  current = await client.getTask(current.id);
@@ -1347,8 +1352,11 @@ program
1347
1352
  ${chalk.bold('Examples:')}
1348
1353
  $ gopherhole send echo "Hello!"
1349
1354
  $ gopherhole send agent-abc123 "What's the weather?"
1355
+ $ gopherhole send agent-abc123 "Free now?" --ttl 0 # fail if offline
1356
+ $ gopherhole send agent-abc123 "Review this" --ttl 3600 # queue up to 1h
1350
1357
  `)
1351
- .action(async (agentId, message) => {
1358
+ .option('--ttl <seconds>', 'Message time-to-live in seconds (0 = no queue, omit = 30 day default)', parseInt)
1359
+ .action(async (agentId, message, cmdOpts) => {
1352
1360
  const sessionId = config.get('sessionId') as string;
1353
1361
  if (!sessionId) {
1354
1362
  console.log(chalk.yellow('Not logged in.'));
@@ -1371,7 +1379,10 @@ ${chalk.bold('Examples:')}
1371
1379
  method: 'SendMessage',
1372
1380
  params: {
1373
1381
  message: { role: 'user', parts: [{ kind: 'text', text: message }] },
1374
- configuration: { agentId },
1382
+ configuration: {
1383
+ agentId,
1384
+ ...(cmdOpts.ttl !== undefined ? { 'x-ttl': cmdOpts.ttl } : {}),
1385
+ },
1375
1386
  },
1376
1387
  id: 1,
1377
1388
  }),