@indexnetwork/cli 0.29.0-rc.88.2 → 0.30.0-rc.100.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 +52 -35
- 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) {
|
|
@@ -1105,7 +1112,7 @@ function intentTable(intents) {
|
|
|
1105
1112
|
month: "short",
|
|
1106
1113
|
day: "numeric"
|
|
1107
1114
|
});
|
|
1108
|
-
const sColor = intent.status === "
|
|
1115
|
+
const sColor = intent.status === "active" ? GREEN : GRAY;
|
|
1109
1116
|
console.log(` ${CYAN}${shortId}${RESET} ${desc.padEnd(descWidth)} ${sColor}${status}${RESET} ${GRAY}${source}${RESET} ${GRAY}${date}${RESET}`);
|
|
1110
1117
|
}
|
|
1111
1118
|
}
|
|
@@ -1150,7 +1157,7 @@ function intentCard(intent) {
|
|
|
1150
1157
|
console.log(` ${BOLD}${CYAN}Intent Details${RESET}`);
|
|
1151
1158
|
console.log(` ${GRAY}${"─".repeat(50)}${RESET}`);
|
|
1152
1159
|
console.log(` ${BOLD}ID${RESET} ${GRAY}${intent.id}${RESET}`);
|
|
1153
|
-
console.log(` ${BOLD}Status${RESET} ${intent.status === "
|
|
1160
|
+
console.log(` ${BOLD}Status${RESET} ${intent.status === "active" ? GREEN : GRAY}${intent.status}${RESET}`);
|
|
1154
1161
|
if (intent.summary) {
|
|
1155
1162
|
console.log(` ${BOLD}Summary${RESET} ${intent.summary}`);
|
|
1156
1163
|
}
|
|
@@ -1165,7 +1172,10 @@ function intentCard(intent) {
|
|
|
1165
1172
|
console.log(` ${BOLD}Mode${RESET} ${intent.intentMode}`);
|
|
1166
1173
|
}
|
|
1167
1174
|
if (intent.sourceType) {
|
|
1168
|
-
console.log(` ${BOLD}Source${RESET}
|
|
1175
|
+
console.log(` ${BOLD}Source type${RESET} ${intent.sourceType}`);
|
|
1176
|
+
}
|
|
1177
|
+
if (intent.sourceId) {
|
|
1178
|
+
console.log(` ${BOLD}Source ID${RESET} ${intent.sourceId}`);
|
|
1169
1179
|
}
|
|
1170
1180
|
if (intent.confidence !== undefined) {
|
|
1171
1181
|
console.log(` ${BOLD}Confidence${RESET} ${confidenceBar(intent.confidence)}`);
|
|
@@ -1405,7 +1415,7 @@ function negotiationCard(negotiation) {
|
|
|
1405
1415
|
console.log(` ${BOLD}Blocked:${RESET} ${YELLOW}${blockedReason}${RESET}`);
|
|
1406
1416
|
console.log(rule);
|
|
1407
1417
|
if (availableActions.length > 0) {
|
|
1408
|
-
dim(` Reply: index negotiation turn ${negotiation.opportunityId.slice(0, 8)} --action <action> --message <text
|
|
1418
|
+
dim(` Reply: index negotiation turn ${negotiation.opportunityId.slice(0, 8)} --action <action> --message <text>`);
|
|
1409
1419
|
}
|
|
1410
1420
|
console.log();
|
|
1411
1421
|
}
|
|
@@ -1417,8 +1427,6 @@ function agentCard(selected) {
|
|
|
1417
1427
|
console.log(rule);
|
|
1418
1428
|
console.log(` ${BOLD}Seat${RESET} External negotiator (negotiates instead of Index's hosted agent)`);
|
|
1419
1429
|
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
1430
|
console.log(` ${BOLD}Last seen${RESET} ${GRAY}${agent.lastSeenAt ? shortDateTime(agent.lastSeenAt) : "never"}${RESET}`);
|
|
1423
1431
|
const onboarding = onboardingCompletedAt ? `${GREEN}complete${RESET} ${GRAY}(${shortDateTime(onboardingCompletedAt)})${RESET}` : `${YELLOW}not complete${RESET}`;
|
|
1424
1432
|
console.log(` ${BOLD}Onboarding${RESET} ${onboarding}`);
|
|
@@ -1674,15 +1682,26 @@ Usage:
|
|
|
1674
1682
|
index intent list [--archived] [--limit <n>] [--query <text>] List your intents
|
|
1675
1683
|
index intent show <id> Show intent details (accepts short ID)
|
|
1676
1684
|
index intent prepare <content> [--answer 'prompt=reply'] Review and repair a draft
|
|
1677
|
-
index intent create <content> [--receipt <token>]
|
|
1685
|
+
index intent create <content> [--receipt <token>] [--source-type <s>] [--source-id <s>] Create an admitted intent
|
|
1678
1686
|
index intent pause <id> | resume <id> Hold or restart its agent
|
|
1679
|
-
index intent update <id> <content>
|
|
1687
|
+
index intent update <id> [<content>] [--source-type <s>] [--source-id <s>] Update description or source fields
|
|
1680
1688
|
index intent archive <id> Archive an intent (accepts short ID)
|
|
1681
1689
|
index intent networks <id> List the networks an intent is shared in
|
|
1682
1690
|
index intent add-to-network <id> <network-id> Add an intent to a network
|
|
1683
1691
|
index intent remove-from-network <id> <network-id> Remove an intent from a network
|
|
1692
|
+
|
|
1693
|
+
--source-type and --source-id are optional strings Index stores and returns
|
|
1694
|
+
unchanged, so a client can map its own records (such as an inferred ambient
|
|
1695
|
+
intent) to the published signal. Pass an empty value to clear one on update.
|
|
1684
1696
|
`;
|
|
1697
|
+
function sourceField(value) {
|
|
1698
|
+
return value === undefined ? undefined : value || null;
|
|
1699
|
+
}
|
|
1685
1700
|
async function handleIntent(client, subcommand, options) {
|
|
1701
|
+
const source = {
|
|
1702
|
+
...options.sourceType !== undefined ? { sourceType: sourceField(options.sourceType) } : {},
|
|
1703
|
+
...options.sourceId !== undefined ? { sourceId: sourceField(options.sourceId) } : {}
|
|
1704
|
+
};
|
|
1686
1705
|
if (!subcommand) {
|
|
1687
1706
|
if (options.json) {
|
|
1688
1707
|
console.log(JSON.stringify({ error: "No subcommand provided" }));
|
|
@@ -1742,7 +1761,7 @@ async function handleIntent(client, subcommand, options) {
|
|
|
1742
1761
|
}
|
|
1743
1762
|
if (!options.json)
|
|
1744
1763
|
info("Processing intent...");
|
|
1745
|
-
const result = await client.createIntent(options.intentContent, options.targetId ? [options.targetId] : undefined, options.receipt);
|
|
1764
|
+
const result = await client.createIntent(options.intentContent, options.targetId ? [options.targetId] : undefined, options.receipt, source);
|
|
1746
1765
|
if (options.json) {
|
|
1747
1766
|
console.log(JSON.stringify(result));
|
|
1748
1767
|
return;
|
|
@@ -1753,16 +1772,16 @@ async function handleIntent(client, subcommand, options) {
|
|
|
1753
1772
|
}
|
|
1754
1773
|
case "update": {
|
|
1755
1774
|
if (!options.intentId) {
|
|
1756
|
-
error("Missing intent ID. Usage: index intent update <id> <content>", 1);
|
|
1775
|
+
error("Missing intent ID. Usage: index intent update <id> [<content>] [--source-type <s>] [--source-id <s>]", 1);
|
|
1757
1776
|
return;
|
|
1758
1777
|
}
|
|
1759
|
-
if (!options.intentContent) {
|
|
1760
|
-
error("
|
|
1778
|
+
if (!options.intentContent && Object.keys(source).length === 0) {
|
|
1779
|
+
error("Nothing to update. Usage: index intent update <id> [<content>] [--source-type <s>] [--source-id <s>]", 1);
|
|
1761
1780
|
return;
|
|
1762
1781
|
}
|
|
1763
1782
|
if (!options.json)
|
|
1764
1783
|
info("Updating intent...");
|
|
1765
|
-
const result = await client.updateIntent(options.intentId, options.intentContent);
|
|
1784
|
+
const result = await client.updateIntent(options.intentId, options.intentContent, source);
|
|
1766
1785
|
if (options.json) {
|
|
1767
1786
|
console.log(JSON.stringify(result));
|
|
1768
1787
|
return;
|
|
@@ -1774,7 +1793,7 @@ async function handleIntent(client, subcommand, options) {
|
|
|
1774
1793
|
case "resume": {
|
|
1775
1794
|
if (!options.intentId)
|
|
1776
1795
|
throw new Error(`Usage: index intent ${subcommand} <id>`);
|
|
1777
|
-
const status = subcommand === "pause" ? "
|
|
1796
|
+
const status = subcommand === "pause" ? "paused" : "active";
|
|
1778
1797
|
await client.updateIntentStatus(options.intentId, status);
|
|
1779
1798
|
if (options.json)
|
|
1780
1799
|
console.log(JSON.stringify({ intentId: options.intentId, status }));
|
|
@@ -1960,12 +1979,9 @@ async function handleNegotiation(client, subcommand, options) {
|
|
|
1960
1979
|
throw new Error("--action must be propose, counter, accept, or decline");
|
|
1961
1980
|
if (!options.message?.trim())
|
|
1962
1981
|
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
1982
|
const negotiation = await client.submitNegotiationTurn(options.targetId, {
|
|
1966
1983
|
action: options.action,
|
|
1967
|
-
message: options.message
|
|
1968
|
-
expectedTurnCount: options.expectedTurnCount
|
|
1984
|
+
message: options.message
|
|
1969
1985
|
});
|
|
1970
1986
|
if (options.json) {
|
|
1971
1987
|
console.log(JSON.stringify(negotiation));
|
|
@@ -1975,7 +1991,7 @@ async function handleNegotiation(client, subcommand, options) {
|
|
|
1975
1991
|
negotiationCard(negotiation);
|
|
1976
1992
|
}
|
|
1977
1993
|
} 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>
|
|
1994
|
+
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
1995
|
}
|
|
1980
1996
|
}
|
|
1981
1997
|
|
|
@@ -2543,7 +2559,7 @@ function renderHelp(json) {
|
|
|
2543
2559
|
negotiation list [--intent-id <id>] [--state open|settled]
|
|
2544
2560
|
negotiation show <opportunity-id>
|
|
2545
2561
|
negotiation turn <opportunity-id> --action propose|counter|accept|decline
|
|
2546
|
-
--message <text>
|
|
2562
|
+
--message <text>
|
|
2547
2563
|
conversation list|with|show|send|answer|stream
|
|
2548
2564
|
conversation show agent --intent-id <id>
|
|
2549
2565
|
conversation send agent <text> --intent-id <id> [--question-id <id>]
|
|
@@ -2700,7 +2716,9 @@ async function main() {
|
|
|
2700
2716
|
targetId: args.targetId,
|
|
2701
2717
|
query: args.query,
|
|
2702
2718
|
receipt: args.receipt,
|
|
2703
|
-
answers: args.answers
|
|
2719
|
+
answers: args.answers,
|
|
2720
|
+
sourceType: args.sourceType,
|
|
2721
|
+
sourceId: args.sourceId
|
|
2704
2722
|
});
|
|
2705
2723
|
return;
|
|
2706
2724
|
case "opportunity":
|
|
@@ -2721,7 +2739,6 @@ async function main() {
|
|
|
2721
2739
|
state: args.state,
|
|
2722
2740
|
action: args.action,
|
|
2723
2741
|
message: args.message,
|
|
2724
|
-
expectedTurnCount: args.expectedTurnCount,
|
|
2725
2742
|
json: args.json
|
|
2726
2743
|
});
|
|
2727
2744
|
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.100.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.100.1",
|
|
24
|
+
"@indexnetwork/cli-linux-arm64": "0.30.0-rc.100.1",
|
|
25
|
+
"@indexnetwork/cli-darwin-x64": "0.30.0-rc.100.1",
|
|
26
|
+
"@indexnetwork/cli-darwin-arm64": "0.30.0-rc.100.1"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@types/bun": "1.3.14"
|