@indexnetwork/cli 0.29.0 → 0.30.0-rc.102.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/README.md +4 -5
- package/dist/index.js +88 -60
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -56,8 +56,8 @@ flags are listed in [Options](#options), and examples follow this reference.
|
|
|
56
56
|
| `index intent list` | List intents, with optional archived, text-query, and result-limit filters. |
|
|
57
57
|
| `index intent show <id>` | Show one intent. |
|
|
58
58
|
| `index intent prepare <text>` | Prepare a draft, optionally answering recovery prompts; returns an admission receipt when ready. |
|
|
59
|
-
| `index intent create <text>` | Create an intent, optionally using the preparation receipt
|
|
60
|
-
| `index intent update <id> <text
|
|
59
|
+
| `index intent create <text>` | Create an intent, optionally using the preparation receipt and client-owned `--source-type` / `--source-id`. |
|
|
60
|
+
| `index intent update <id> [<text>]` | Update and reprocess an intent's description, or set `--source-type` / `--source-id` (empty clears). |
|
|
61
61
|
| `index intent archive <id>` | Archive an intent so it stops participating in discovery. |
|
|
62
62
|
| `index intent pause <id>` / `resume <id>` | Pause or resume its agent without archiving. |
|
|
63
63
|
| `index intent networks <id>` | List the networks an intent is shared in. |
|
|
@@ -65,7 +65,7 @@ flags are listed in [Options](#options), and examples follow this reference.
|
|
|
65
65
|
| `index intent remove-from-network <id> <network-id>` | Stop sharing an intent in a network. |
|
|
66
66
|
| `index negotiation list` | List negotiations, optionally filtered by intent or open/settled state. |
|
|
67
67
|
| `index negotiation show <opportunity-id>` | Read the negotiation's turns, current state, and available actions. |
|
|
68
|
-
| `index negotiation turn <opportunity-id> --action <action> --message <text
|
|
68
|
+
| `index negotiation turn <opportunity-id> --action <action> --message <text>` | Submit one `propose`, `counter`, `accept`, or `decline` turn. |
|
|
69
69
|
| `index opportunity list` | List persisted opportunities, with optional status and result-limit filters. |
|
|
70
70
|
| `index opportunity show <id>` | Show an opportunity's presentation and participants. |
|
|
71
71
|
| `index opportunity accept <id>` | Request acceptance through the server's owner-approval flow. |
|
|
@@ -176,7 +176,7 @@ Read current negotiations and submit structured turns using full opportunity IDs
|
|
|
176
176
|
```bash
|
|
177
177
|
index negotiation list [--intent-id <id>] [--state open|settled]
|
|
178
178
|
index negotiation show <opportunity-id> --json
|
|
179
|
-
index negotiation turn <opportunity-id> --action propose --message "..." --
|
|
179
|
+
index negotiation turn <opportunity-id> --action propose --message "..." --json
|
|
180
180
|
```
|
|
181
181
|
|
|
182
182
|
Actions are `propose`, `counter`, `accept`, and `decline`. Read the detail's
|
|
@@ -336,7 +336,6 @@ index opportunity reject <id>
|
|
|
336
336
|
| `--state <state>` | | Filter negotiations by `open` or `settled` |
|
|
337
337
|
| `--action <action>` | | Required negotiation turn action: `propose`, `counter`, `accept`, or `decline` |
|
|
338
338
|
| `--message <text>` | | Required message for a negotiation turn |
|
|
339
|
-
| `--expected-turn-count <n>` | | Required observed nonnegative integer turn count for a negotiation turn |
|
|
340
339
|
| `--question-id <id>` | | Identify the displayed question when answering the personal agent |
|
|
341
340
|
| `--answer <key=value>` | | Repeat for recovery prompt labels or agent question IDs |
|
|
342
341
|
| `--receipt <token>` | | Preparation receipt for intent creation |
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { spawn } from "node:child_process";
|
|
|
5
5
|
// package.json
|
|
6
6
|
var package_default = {
|
|
7
7
|
name: "@indexnetwork/cli",
|
|
8
|
-
version: "0.
|
|
8
|
+
version: "0.30.0",
|
|
9
9
|
description: "Command-line interface for Index Network",
|
|
10
10
|
license: "MIT",
|
|
11
11
|
type: "module",
|
|
@@ -25,10 +25,10 @@ var package_default = {
|
|
|
25
25
|
"publish:all": "bun scripts/publish.ts"
|
|
26
26
|
},
|
|
27
27
|
optionalDependencies: {
|
|
28
|
-
"@indexnetwork/cli-linux-x64": "0.
|
|
29
|
-
"@indexnetwork/cli-linux-arm64": "0.
|
|
30
|
-
"@indexnetwork/cli-darwin-x64": "0.
|
|
31
|
-
"@indexnetwork/cli-darwin-arm64": "0.
|
|
28
|
+
"@indexnetwork/cli-linux-x64": "0.30.0",
|
|
29
|
+
"@indexnetwork/cli-linux-arm64": "0.30.0",
|
|
30
|
+
"@indexnetwork/cli-darwin-x64": "0.30.0",
|
|
31
|
+
"@indexnetwork/cli-darwin-arm64": "0.30.0"
|
|
32
32
|
},
|
|
33
33
|
devDependencies: {
|
|
34
34
|
"@types/bun": "1.3.14"
|
|
@@ -95,7 +95,7 @@ function parseArgs(args) {
|
|
|
95
95
|
return { ...result, command: "version" };
|
|
96
96
|
if (["--api-url", "--app-url", "--status", "--limit", "--prompt", "-p", "--objective", "--title"].includes(arg) && (!args[i + 1] || args[i + 1].startsWith("--")))
|
|
97
97
|
throw new Error(`Missing value for ${arg}`);
|
|
98
|
-
if (["--query", "--state", "--action", "--message", "--intent-id", "--question-id", "--
|
|
98
|
+
if (["--query", "--state", "--action", "--message", "--intent-id", "--question-id", "--receipt", "--source-type", "--source-id", "--name", "--intro", "--location", "--statuses", "--answer", "--social"].includes(arg)) {
|
|
99
99
|
const value = args[i + 1];
|
|
100
100
|
if (value === undefined || value.startsWith("--"))
|
|
101
101
|
throw new Error(`Missing value for ${arg}`);
|
|
@@ -118,12 +118,15 @@ function parseArgs(args) {
|
|
|
118
118
|
case "--question-id":
|
|
119
119
|
result.questionId = value;
|
|
120
120
|
break;
|
|
121
|
-
case "--expected-turn-count":
|
|
122
|
-
result.expectedTurnCount = Number(value);
|
|
123
|
-
break;
|
|
124
121
|
case "--receipt":
|
|
125
122
|
result.receipt = value;
|
|
126
123
|
break;
|
|
124
|
+
case "--source-type":
|
|
125
|
+
result.sourceType = value;
|
|
126
|
+
break;
|
|
127
|
+
case "--source-id":
|
|
128
|
+
result.sourceId = value;
|
|
129
|
+
break;
|
|
127
130
|
case "--name":
|
|
128
131
|
result.name = value;
|
|
129
132
|
break;
|
|
@@ -454,11 +457,12 @@ class ApiClient {
|
|
|
454
457
|
const body = await res.json();
|
|
455
458
|
return body.intent;
|
|
456
459
|
}
|
|
457
|
-
async createIntent(description, networkIds, preparationReceipt) {
|
|
460
|
+
async createIntent(description, networkIds, preparationReceipt, source = {}) {
|
|
458
461
|
const res = await this.post("/api/intents", {
|
|
459
462
|
description,
|
|
460
463
|
...networkIds?.length ? { networkIds } : {},
|
|
461
|
-
...preparationReceipt ? { preparationReceipt } : {}
|
|
464
|
+
...preparationReceipt ? { preparationReceipt } : {},
|
|
465
|
+
...source
|
|
462
466
|
});
|
|
463
467
|
return await res.json();
|
|
464
468
|
}
|
|
@@ -469,8 +473,11 @@ class ApiClient {
|
|
|
469
473
|
async updateIntentStatus(id, status) {
|
|
470
474
|
await this.patch(`/api/intents/${encodeURIComponent(id)}/status`, { status });
|
|
471
475
|
}
|
|
472
|
-
async updateIntent(intentId, description) {
|
|
473
|
-
const res = await this.patch(`/api/intents/${encodeURIComponent(intentId)}`, {
|
|
476
|
+
async updateIntent(intentId, description, source = {}) {
|
|
477
|
+
const res = await this.patch(`/api/intents/${encodeURIComponent(intentId)}`, {
|
|
478
|
+
...description !== undefined ? { description } : {},
|
|
479
|
+
...source
|
|
480
|
+
});
|
|
474
481
|
return await res.json();
|
|
475
482
|
}
|
|
476
483
|
async archiveIntent(intentId) {
|
|
@@ -915,38 +922,49 @@ async function handleLogin(apiUrl, appUrl, store, options = {}) {
|
|
|
915
922
|
};
|
|
916
923
|
}
|
|
917
924
|
var WORDMARK_SVG = `<svg viewBox="0 0 522 44" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
918
|
-
<path d="M184.51 21.66C184.51 18.33 187.42 15.73 191.23 15.73C195.04 15.73 197.95 18.33 197.95 21.66C197.95 24.99 195.1 27.54 191.23 27.54C187.36 27.54 184.51 25 184.51 21.66Z" fill="
|
|
919
|
-
<path d="M0 0.72998H7.47V42.61H0V0.72998Z" fill="
|
|
920
|
-
<path d="M16.6301 0.72998H25.0701L44.3701 27.26H45.4001V0.72998H52.9301V42.61H44.4301L25.1901 16.08H24.1001V42.61H16.6301V0.72998Z" fill="
|
|
921
|
-
<path d="M99.91 21.67C99.91 33.63 90.74 42.61 78.54 42.61H62.03V0.72998H78.54C90.74 0.72998 99.91 9.70995 99.91 21.67ZM92.2 21.67C92.2 14.93 86.25 9.88998 78.3 9.88998H69.5V33.44H78.3C86.25 33.44 92.2 28.4 92.2 21.66V21.67Z" fill="
|
|
922
|
-
<path d="M137.61 33.45V42.62H107.08V0.73999H137.31V9.91H114.55V17.13H135.31V25.99H114.55V33.46H137.62L137.61 33.45Z" fill="
|
|
923
|
-
<path d="M167.53 21.7899L181.49 42.61H172.75L162.43 27.86H160.97L150.71 42.61H141.3L155.56 21.37L141.84 0.72998H150.58L160.66 15.36H162.06L172.14 0.72998H181.55L167.53 21.7899Z" fill="
|
|
924
|
-
<path d="M209.87 0.72998H218.31L237.61 27.26H238.64V0.72998H246.17V42.61H237.67L218.43 16.08H217.34V42.61H209.87V0.72998Z" fill="
|
|
925
|
-
<path d="M285.8 33.45V42.62H255.27V0.73999H285.5V9.91H262.74V17.13H283.5V25.99H262.74V33.46H285.81L285.8 33.45Z" fill="
|
|
926
|
-
<path d="M324.77 9.88998H311.48V42.61H304.01V9.88998H290.72V0.719971H324.77V9.88998Z" fill="
|
|
927
|
-
<path d="M328.96 0.72998H336.91L346.14 28.35H347.41L356.09 0.72998H362.71L371.45 28.35H372.79L381.89 0.72998H390.33L376.92 42.61H368.42L360.59 17.24H358.71L350.88 42.61H342.38L328.97 0.72998H328.96Z" fill="
|
|
928
|
-
<path d="M391.54 21.67C391.54 9.34998 401.07 0 413.7 0C426.33 0 435.86 9.34998 435.86 21.67C435.86 33.99 426.33 43.34 413.7 43.34C401.07 43.34 391.54 33.99 391.54 21.67ZM428.14 21.67C428.14 14.63 421.89 9.35004 413.69 9.35004C405.49 9.35004 399.24 14.63 399.24 21.67C399.24 28.71 405.49 33.99 413.69 33.99C421.89 33.99 428.14 28.71 428.14 21.67Z" fill="
|
|
929
|
-
<path d="M459.46 29.5H450.42V42.61H442.95V0.72998H462.13C470.57 0.72998 477 6.91996 477 15.12C477 21.31 473.36 26.35 467.9 28.47L477.55 42.61H468.45L459.47 29.5H459.46ZM450.42 20.33H461.95C466.44 20.33 469.23 18.27 469.23 15.11C469.23 11.95 466.44 9.88998 461.95 9.88998H450.42V20.33Z" fill="
|
|
930
|
-
<path d="M497.83 25.56L491.4 30.96V42.61H483.93V0.72998H491.4V17.67H492.92L509.07 0.72998H521.03L503.31 20.21L521.46 42.61H512.11L497.85 25.55L497.83 25.56Z" fill="
|
|
925
|
+
<path d="M184.51 21.66C184.51 18.33 187.42 15.73 191.23 15.73C195.04 15.73 197.95 18.33 197.95 21.66C197.95 24.99 195.1 27.54 191.23 27.54C187.36 27.54 184.51 25 184.51 21.66Z" fill="currentColor"/>
|
|
926
|
+
<path d="M0 0.72998H7.47V42.61H0V0.72998Z" fill="currentColor"/>
|
|
927
|
+
<path d="M16.6301 0.72998H25.0701L44.3701 27.26H45.4001V0.72998H52.9301V42.61H44.4301L25.1901 16.08H24.1001V42.61H16.6301V0.72998Z" fill="currentColor"/>
|
|
928
|
+
<path d="M99.91 21.67C99.91 33.63 90.74 42.61 78.54 42.61H62.03V0.72998H78.54C90.74 0.72998 99.91 9.70995 99.91 21.67ZM92.2 21.67C92.2 14.93 86.25 9.88998 78.3 9.88998H69.5V33.44H78.3C86.25 33.44 92.2 28.4 92.2 21.66V21.67Z" fill="currentColor"/>
|
|
929
|
+
<path d="M137.61 33.45V42.62H107.08V0.73999H137.31V9.91H114.55V17.13H135.31V25.99H114.55V33.46H137.62L137.61 33.45Z" fill="currentColor"/>
|
|
930
|
+
<path d="M167.53 21.7899L181.49 42.61H172.75L162.43 27.86H160.97L150.71 42.61H141.3L155.56 21.37L141.84 0.72998H150.58L160.66 15.36H162.06L172.14 0.72998H181.55L167.53 21.7899Z" fill="currentColor"/>
|
|
931
|
+
<path d="M209.87 0.72998H218.31L237.61 27.26H238.64V0.72998H246.17V42.61H237.67L218.43 16.08H217.34V42.61H209.87V0.72998Z" fill="currentColor"/>
|
|
932
|
+
<path d="M285.8 33.45V42.62H255.27V0.73999H285.5V9.91H262.74V17.13H283.5V25.99H262.74V33.46H285.81L285.8 33.45Z" fill="currentColor"/>
|
|
933
|
+
<path d="M324.77 9.88998H311.48V42.61H304.01V9.88998H290.72V0.719971H324.77V9.88998Z" fill="currentColor"/>
|
|
934
|
+
<path d="M328.96 0.72998H336.91L346.14 28.35H347.41L356.09 0.72998H362.71L371.45 28.35H372.79L381.89 0.72998H390.33L376.92 42.61H368.42L360.59 17.24H358.71L350.88 42.61H342.38L328.97 0.72998H328.96Z" fill="currentColor"/>
|
|
935
|
+
<path d="M391.54 21.67C391.54 9.34998 401.07 0 413.7 0C426.33 0 435.86 9.34998 435.86 21.67C435.86 33.99 426.33 43.34 413.7 43.34C401.07 43.34 391.54 33.99 391.54 21.67ZM428.14 21.67C428.14 14.63 421.89 9.35004 413.69 9.35004C405.49 9.35004 399.24 14.63 399.24 21.67C399.24 28.71 405.49 33.99 413.69 33.99C421.89 33.99 428.14 28.71 428.14 21.67Z" fill="currentColor"/>
|
|
936
|
+
<path d="M459.46 29.5H450.42V42.61H442.95V0.72998H462.13C470.57 0.72998 477 6.91996 477 15.12C477 21.31 473.36 26.35 467.9 28.47L477.55 42.61H468.45L459.47 29.5H459.46ZM450.42 20.33H461.95C466.44 20.33 469.23 18.27 469.23 15.11C469.23 11.95 466.44 9.88998 461.95 9.88998H450.42V20.33Z" fill="currentColor"/>
|
|
937
|
+
<path d="M497.83 25.56L491.4 30.96V42.61H483.93V0.72998H491.4V17.67H492.92L509.07 0.72998H521.03L503.31 20.21L521.46 42.61H512.11L497.85 25.55L497.83 25.56Z" fill="currentColor"/>
|
|
931
938
|
</svg>`;
|
|
932
939
|
function callbackHtml(title, message, ok = false) {
|
|
933
|
-
const
|
|
934
|
-
return `<!doctype html><html><head><meta charset="utf-8"
|
|
940
|
+
const tag = ok ? `<span class="tag">signed in</span>` : "";
|
|
941
|
+
return `<!doctype html><html lang="en"><head><meta charset="utf-8">
|
|
942
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
943
|
+
<title>${title} · Index</title>
|
|
935
944
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
936
945
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
937
|
-
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=
|
|
946
|
+
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Source+Serif+4:opsz,wght@8..60,400&family=Public+Sans:wght@300;400;500&display=swap">
|
|
938
947
|
<style>
|
|
939
|
-
|
|
940
|
-
|
|
948
|
+
:root{--ink:#041729;--bg:#FCFEFB;--body:#2E3B45;--green:#123A00;--mono:'SF Mono',Menlo,Consolas,monospace}
|
|
949
|
+
*{box-sizing:border-box}
|
|
950
|
+
html,body{margin:0;background:var(--bg);color:var(--ink)}
|
|
951
|
+
body{min-height:100vh;display:flex;flex-direction:column;font-family:'Public Sans',system-ui,sans-serif;-webkit-font-smoothing:antialiased}
|
|
952
|
+
.col{width:100%;max-width:836px;margin:0 auto;padding:0 24px}
|
|
953
|
+
.nav{padding:26px 0;color:var(--ink)}
|
|
941
954
|
.nav svg{height:14px;width:auto;display:block}
|
|
942
|
-
main{flex:1;display:flex;align-items:center
|
|
943
|
-
.c{
|
|
944
|
-
.
|
|
945
|
-
h1{font-
|
|
946
|
-
p{font-size:
|
|
955
|
+
main{flex:1;display:flex;align-items:center}
|
|
956
|
+
.c{display:flex;flex-direction:column;align-items:flex-start;gap:22px;padding:40px 0 12vh;max-width:520px}
|
|
957
|
+
.tag{display:inline-flex;font-family:var(--mono);font-size:11px;letter-spacing:.1em;text-transform:uppercase;padding:5px 9px;background:#E3F0DE;color:var(--green)}
|
|
958
|
+
h1{margin:0;font-family:'Source Serif 4',Georgia,serif;font-weight:400;font-size:40px;line-height:1.2;letter-spacing:-.015em}
|
|
959
|
+
p{margin:0;font-size:15px;line-height:1.7;font-weight:300;color:var(--body)}
|
|
960
|
+
footer{padding:24px 0;font-family:var(--mono);font-size:11px;color:var(--green)}
|
|
961
|
+
@media (max-width:520px){h1{font-size:32px}}
|
|
947
962
|
</style></head>
|
|
948
|
-
<body
|
|
949
|
-
<
|
|
963
|
+
<body>
|
|
964
|
+
<div class="col"><nav class="nav" aria-label="Index Network">${WORDMARK_SVG}</nav></div>
|
|
965
|
+
<main><div class="col"><div class="c">${tag}<h1>${title}</h1><p>${message}</p></div></div></main>
|
|
966
|
+
<div class="col"><footer>index.network</footer></div>
|
|
967
|
+
</body></html>`;
|
|
950
968
|
}
|
|
951
969
|
|
|
952
970
|
// src/logout.command.ts
|
|
@@ -1105,7 +1123,7 @@ function intentTable(intents) {
|
|
|
1105
1123
|
month: "short",
|
|
1106
1124
|
day: "numeric"
|
|
1107
1125
|
});
|
|
1108
|
-
const sColor = intent.status === "
|
|
1126
|
+
const sColor = intent.status === "active" ? GREEN : GRAY;
|
|
1109
1127
|
console.log(` ${CYAN}${shortId}${RESET} ${desc.padEnd(descWidth)} ${sColor}${status}${RESET} ${GRAY}${source}${RESET} ${GRAY}${date}${RESET}`);
|
|
1110
1128
|
}
|
|
1111
1129
|
}
|
|
@@ -1150,7 +1168,7 @@ function intentCard(intent) {
|
|
|
1150
1168
|
console.log(` ${BOLD}${CYAN}Intent Details${RESET}`);
|
|
1151
1169
|
console.log(` ${GRAY}${"─".repeat(50)}${RESET}`);
|
|
1152
1170
|
console.log(` ${BOLD}ID${RESET} ${GRAY}${intent.id}${RESET}`);
|
|
1153
|
-
console.log(` ${BOLD}Status${RESET} ${intent.status === "
|
|
1171
|
+
console.log(` ${BOLD}Status${RESET} ${intent.status === "active" ? GREEN : GRAY}${intent.status}${RESET}`);
|
|
1154
1172
|
if (intent.summary) {
|
|
1155
1173
|
console.log(` ${BOLD}Summary${RESET} ${intent.summary}`);
|
|
1156
1174
|
}
|
|
@@ -1165,7 +1183,10 @@ function intentCard(intent) {
|
|
|
1165
1183
|
console.log(` ${BOLD}Mode${RESET} ${intent.intentMode}`);
|
|
1166
1184
|
}
|
|
1167
1185
|
if (intent.sourceType) {
|
|
1168
|
-
console.log(` ${BOLD}Source${RESET}
|
|
1186
|
+
console.log(` ${BOLD}Source type${RESET} ${intent.sourceType}`);
|
|
1187
|
+
}
|
|
1188
|
+
if (intent.sourceId) {
|
|
1189
|
+
console.log(` ${BOLD}Source ID${RESET} ${intent.sourceId}`);
|
|
1169
1190
|
}
|
|
1170
1191
|
if (intent.confidence !== undefined) {
|
|
1171
1192
|
console.log(` ${BOLD}Confidence${RESET} ${confidenceBar(intent.confidence)}`);
|
|
@@ -1405,7 +1426,7 @@ function negotiationCard(negotiation) {
|
|
|
1405
1426
|
console.log(` ${BOLD}Blocked:${RESET} ${YELLOW}${blockedReason}${RESET}`);
|
|
1406
1427
|
console.log(rule);
|
|
1407
1428
|
if (availableActions.length > 0) {
|
|
1408
|
-
dim(` Reply: index negotiation turn ${negotiation.opportunityId.slice(0, 8)} --action <action> --message <text
|
|
1429
|
+
dim(` Reply: index negotiation turn ${negotiation.opportunityId.slice(0, 8)} --action <action> --message <text>`);
|
|
1409
1430
|
}
|
|
1410
1431
|
console.log();
|
|
1411
1432
|
}
|
|
@@ -1417,8 +1438,6 @@ function agentCard(selected) {
|
|
|
1417
1438
|
console.log(rule);
|
|
1418
1439
|
console.log(` ${BOLD}Seat${RESET} External negotiator (negotiates instead of Index's hosted agent)`);
|
|
1419
1440
|
console.log(` ${BOLD}Status${RESET} ${agent.status === "active" ? GREEN : GRAY}${agent.status}${RESET}`);
|
|
1420
|
-
if (agent.description)
|
|
1421
|
-
console.log(` ${BOLD}Description${RESET} ${agent.description}`);
|
|
1422
1441
|
console.log(` ${BOLD}Last seen${RESET} ${GRAY}${agent.lastSeenAt ? shortDateTime(agent.lastSeenAt) : "never"}${RESET}`);
|
|
1423
1442
|
const onboarding = onboardingCompletedAt ? `${GREEN}complete${RESET} ${GRAY}(${shortDateTime(onboardingCompletedAt)})${RESET}` : `${YELLOW}not complete${RESET}`;
|
|
1424
1443
|
console.log(` ${BOLD}Onboarding${RESET} ${onboarding}`);
|
|
@@ -1674,15 +1693,26 @@ Usage:
|
|
|
1674
1693
|
index intent list [--archived] [--limit <n>] [--query <text>] List your intents
|
|
1675
1694
|
index intent show <id> Show intent details (accepts short ID)
|
|
1676
1695
|
index intent prepare <content> [--answer 'prompt=reply'] Review and repair a draft
|
|
1677
|
-
index intent create <content> [--receipt <token>]
|
|
1696
|
+
index intent create <content> [--receipt <token>] [--source-type <s>] [--source-id <s>] Create an admitted intent
|
|
1678
1697
|
index intent pause <id> | resume <id> Hold or restart its agent
|
|
1679
|
-
index intent update <id> <content>
|
|
1698
|
+
index intent update <id> [<content>] [--source-type <s>] [--source-id <s>] Update description or source fields
|
|
1680
1699
|
index intent archive <id> Archive an intent (accepts short ID)
|
|
1681
1700
|
index intent networks <id> List the networks an intent is shared in
|
|
1682
1701
|
index intent add-to-network <id> <network-id> Add an intent to a network
|
|
1683
1702
|
index intent remove-from-network <id> <network-id> Remove an intent from a network
|
|
1703
|
+
|
|
1704
|
+
--source-type and --source-id are optional strings Index stores and returns
|
|
1705
|
+
unchanged, so a client can map its own records (such as an inferred ambient
|
|
1706
|
+
intent) to the published signal. Pass an empty value to clear one on update.
|
|
1684
1707
|
`;
|
|
1708
|
+
function sourceField(value) {
|
|
1709
|
+
return value === undefined ? undefined : value || null;
|
|
1710
|
+
}
|
|
1685
1711
|
async function handleIntent(client, subcommand, options) {
|
|
1712
|
+
const source = {
|
|
1713
|
+
...options.sourceType !== undefined ? { sourceType: sourceField(options.sourceType) } : {},
|
|
1714
|
+
...options.sourceId !== undefined ? { sourceId: sourceField(options.sourceId) } : {}
|
|
1715
|
+
};
|
|
1686
1716
|
if (!subcommand) {
|
|
1687
1717
|
if (options.json) {
|
|
1688
1718
|
console.log(JSON.stringify({ error: "No subcommand provided" }));
|
|
@@ -1742,7 +1772,7 @@ async function handleIntent(client, subcommand, options) {
|
|
|
1742
1772
|
}
|
|
1743
1773
|
if (!options.json)
|
|
1744
1774
|
info("Processing intent...");
|
|
1745
|
-
const result = await client.createIntent(options.intentContent, options.targetId ? [options.targetId] : undefined, options.receipt);
|
|
1775
|
+
const result = await client.createIntent(options.intentContent, options.targetId ? [options.targetId] : undefined, options.receipt, source);
|
|
1746
1776
|
if (options.json) {
|
|
1747
1777
|
console.log(JSON.stringify(result));
|
|
1748
1778
|
return;
|
|
@@ -1753,16 +1783,16 @@ async function handleIntent(client, subcommand, options) {
|
|
|
1753
1783
|
}
|
|
1754
1784
|
case "update": {
|
|
1755
1785
|
if (!options.intentId) {
|
|
1756
|
-
error("Missing intent ID. Usage: index intent update <id> <content>", 1);
|
|
1786
|
+
error("Missing intent ID. Usage: index intent update <id> [<content>] [--source-type <s>] [--source-id <s>]", 1);
|
|
1757
1787
|
return;
|
|
1758
1788
|
}
|
|
1759
|
-
if (!options.intentContent) {
|
|
1760
|
-
error("
|
|
1789
|
+
if (!options.intentContent && Object.keys(source).length === 0) {
|
|
1790
|
+
error("Nothing to update. Usage: index intent update <id> [<content>] [--source-type <s>] [--source-id <s>]", 1);
|
|
1761
1791
|
return;
|
|
1762
1792
|
}
|
|
1763
1793
|
if (!options.json)
|
|
1764
1794
|
info("Updating intent...");
|
|
1765
|
-
const result = await client.updateIntent(options.intentId, options.intentContent);
|
|
1795
|
+
const result = await client.updateIntent(options.intentId, options.intentContent, source);
|
|
1766
1796
|
if (options.json) {
|
|
1767
1797
|
console.log(JSON.stringify(result));
|
|
1768
1798
|
return;
|
|
@@ -1774,7 +1804,7 @@ async function handleIntent(client, subcommand, options) {
|
|
|
1774
1804
|
case "resume": {
|
|
1775
1805
|
if (!options.intentId)
|
|
1776
1806
|
throw new Error(`Usage: index intent ${subcommand} <id>`);
|
|
1777
|
-
const status = subcommand === "pause" ? "
|
|
1807
|
+
const status = subcommand === "pause" ? "paused" : "active";
|
|
1778
1808
|
await client.updateIntentStatus(options.intentId, status);
|
|
1779
1809
|
if (options.json)
|
|
1780
1810
|
console.log(JSON.stringify({ intentId: options.intentId, status }));
|
|
@@ -1960,12 +1990,9 @@ async function handleNegotiation(client, subcommand, options) {
|
|
|
1960
1990
|
throw new Error("--action must be propose, counter, accept, or decline");
|
|
1961
1991
|
if (!options.message?.trim())
|
|
1962
1992
|
throw new Error("--message is required");
|
|
1963
|
-
if (options.expectedTurnCount === undefined || !Number.isSafeInteger(options.expectedTurnCount) || options.expectedTurnCount < 0)
|
|
1964
|
-
throw new Error("--expected-turn-count must be the observed nonnegative integer turn count");
|
|
1965
1993
|
const negotiation = await client.submitNegotiationTurn(options.targetId, {
|
|
1966
1994
|
action: options.action,
|
|
1967
|
-
message: options.message
|
|
1968
|
-
expectedTurnCount: options.expectedTurnCount
|
|
1995
|
+
message: options.message
|
|
1969
1996
|
});
|
|
1970
1997
|
if (options.json) {
|
|
1971
1998
|
console.log(JSON.stringify(negotiation));
|
|
@@ -1975,7 +2002,7 @@ async function handleNegotiation(client, subcommand, options) {
|
|
|
1975
2002
|
negotiationCard(negotiation);
|
|
1976
2003
|
}
|
|
1977
2004
|
} else {
|
|
1978
|
-
throw new Error("Usage: index negotiation list [--intent-id <id>] [--state open|settled], show <opportunity-id>, or turn <opportunity-id> --action <action> --message <text>
|
|
2005
|
+
throw new Error("Usage: index negotiation list [--intent-id <id>] [--state open|settled], show <opportunity-id>, or turn <opportunity-id> --action <action> --message <text>");
|
|
1979
2006
|
}
|
|
1980
2007
|
}
|
|
1981
2008
|
|
|
@@ -2543,7 +2570,7 @@ function renderHelp(json) {
|
|
|
2543
2570
|
negotiation list [--intent-id <id>] [--state open|settled]
|
|
2544
2571
|
negotiation show <opportunity-id>
|
|
2545
2572
|
negotiation turn <opportunity-id> --action propose|counter|accept|decline
|
|
2546
|
-
--message <text>
|
|
2573
|
+
--message <text>
|
|
2547
2574
|
conversation list|with|show|send|answer|stream
|
|
2548
2575
|
conversation show agent --intent-id <id>
|
|
2549
2576
|
conversation send agent <text> --intent-id <id> [--question-id <id>]
|
|
@@ -2700,7 +2727,9 @@ async function main() {
|
|
|
2700
2727
|
targetId: args.targetId,
|
|
2701
2728
|
query: args.query,
|
|
2702
2729
|
receipt: args.receipt,
|
|
2703
|
-
answers: args.answers
|
|
2730
|
+
answers: args.answers,
|
|
2731
|
+
sourceType: args.sourceType,
|
|
2732
|
+
sourceId: args.sourceId
|
|
2704
2733
|
});
|
|
2705
2734
|
return;
|
|
2706
2735
|
case "opportunity":
|
|
@@ -2721,7 +2750,6 @@ async function main() {
|
|
|
2721
2750
|
state: args.state,
|
|
2722
2751
|
action: args.action,
|
|
2723
2752
|
message: args.message,
|
|
2724
|
-
expectedTurnCount: args.expectedTurnCount,
|
|
2725
2753
|
json: args.json
|
|
2726
2754
|
});
|
|
2727
2755
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@indexnetwork/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.30.0-rc.102.1",
|
|
4
4
|
"description": "Command-line interface for Index Network",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
"publish:all": "bun scripts/publish.ts"
|
|
21
21
|
},
|
|
22
22
|
"optionalDependencies": {
|
|
23
|
-
"@indexnetwork/cli-linux-x64": "0.
|
|
24
|
-
"@indexnetwork/cli-linux-arm64": "0.
|
|
25
|
-
"@indexnetwork/cli-darwin-x64": "0.
|
|
26
|
-
"@indexnetwork/cli-darwin-arm64": "0.
|
|
23
|
+
"@indexnetwork/cli-linux-x64": "0.30.0-rc.102.1",
|
|
24
|
+
"@indexnetwork/cli-linux-arm64": "0.30.0-rc.102.1",
|
|
25
|
+
"@indexnetwork/cli-darwin-x64": "0.30.0-rc.102.1",
|
|
26
|
+
"@indexnetwork/cli-darwin-arm64": "0.30.0-rc.102.1"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/bun": "1.3.14"
|