@alpacakit/agents-conventions 0.1.0-beta.37 → 0.1.0-beta.39
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 +38 -25
- package/dist/cli-output.js +1 -1
- package/dist/cli.d.ts +715 -151
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +121 -40
- package/dist/home.d.ts.map +1 -1
- package/dist/register.d.ts.map +1 -1
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -74,10 +74,11 @@ const result = await loginManagedHome({
|
|
|
74
74
|
|
|
75
75
|
## `@alpacakit/agents-conventions/cli`
|
|
76
76
|
|
|
77
|
-
The `agent`
|
|
78
|
-
owns the command paths,
|
|
79
|
-
|
|
80
|
-
`promptopt agent login`
|
|
77
|
+
The shared `agent` Endpoint tree — no `bin`, parser, output writer, or startup
|
|
78
|
+
I/O. It owns the command paths, flags, procedure-input projection, and five
|
|
79
|
+
thin procedure handlers, so `alpacaloop agent login` and
|
|
80
|
+
`promptopt agent login` execute the same operation. Collecting the tree and
|
|
81
|
+
rendering help do not open the agents home, keyring, login process, or stdin.
|
|
81
82
|
|
|
82
83
|
```
|
|
83
84
|
agent list
|
|
@@ -88,31 +89,43 @@ agent add <ID> --kind openai-compatible --base-url <URL> --model <M>
|
|
|
88
89
|
agent remove <NAME>
|
|
89
90
|
```
|
|
90
91
|
|
|
91
|
-
Mount the node in the product's tree
|
|
92
|
-
|
|
92
|
+
Mount the node in the product's tree. The host parser passes only explicitly
|
|
93
|
+
supplied canonical parameter names to `parseOptions`; after it succeeds, the
|
|
94
|
+
host supplies an invocation-scoped `AgentEntryContext` and calls the collected
|
|
95
|
+
handler directly:
|
|
93
96
|
|
|
94
97
|
```ts
|
|
95
|
-
import {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
);
|
|
98
|
+
import {
|
|
99
|
+
AGENT_CLI_SURFACE,
|
|
100
|
+
type AgentEntryContext,
|
|
101
|
+
} from "@alpacakit/agents-conventions/cli";
|
|
102
|
+
import { collectCliCommands } from "@alpacakit/channels/cli";
|
|
103
|
+
|
|
104
|
+
const view = collectCliCommands(AGENT_CLI_SURFACE.node);
|
|
105
|
+
// During host action registration, for each collected command:
|
|
106
|
+
const input = command.input.parseOptions(explicitCanonicalValues);
|
|
107
|
+
const outcome = await command.handler(input, context satisfies AgentEntryContext);
|
|
108
|
+
render(outcome); // text, JSON envelope, redaction, and exit status are host-owned
|
|
104
109
|
```
|
|
105
110
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
`
|
|
115
|
-
|
|
111
|
+
`AgentEntryContext` contains `{ homeDir, env, ports?, keyring?,
|
|
112
|
+
readCredentialSecret, onLoginEvent, signal? }`. `onLoginEvent` receives the
|
|
113
|
+
typed `LoginEvent`; the host decides how to display it. `--stdin` identifies
|
|
114
|
+
the input source: only the credential-add handler calls
|
|
115
|
+
`readCredentialSecret()`, once, after input validation succeeds.
|
|
116
|
+
|
|
117
|
+
Each handler returns `AgentEntryOutcome`, discriminated by the corresponding
|
|
118
|
+
`AGENT_ENTRY_NAME` in `operation`, with the unchanged procedure result in
|
|
119
|
+
`result`. This is not a CLI text/JSON envelope and carries no exit or
|
|
120
|
+
presentation policy. Optional flags stay absent when unset — `--engine` is
|
|
121
|
+
defaulted once by the persisted agent-config payload. The addable kinds
|
|
122
|
+
(`AGENT_ADD_KIND`) remain on the root export beside the procedure that acts on
|
|
123
|
+
them; `/cli` only spells them as a flag.
|
|
124
|
+
|
|
125
|
+
`AGENT_CLI_SURFACE.outputs.<operation>.schema` remains the explicit validator
|
|
126
|
+
for the inner procedure result used by existing projectors. It intentionally
|
|
127
|
+
does not validate the tagged `AgentEntryOutcome` wrapper; presentation code
|
|
128
|
+
selects the operation and validates `outcome.result` when required.
|
|
116
129
|
|
|
117
130
|
`@alpacakit/channels` and `zod` are **peer** dependencies of this package: they
|
|
118
131
|
are needed only by `/cli`, so importing the procedures never drags a CLI
|
package/dist/cli-output.js
CHANGED
|
@@ -8,8 +8,8 @@ import { AGENT_AVAILABILITY_STATUS, AGENT_INDETERMINATE_REASON, AGENT_UNAVAILABL
|
|
|
8
8
|
import { CANDIDATE_SOURCE_KIND } from "@alpacakit/agents/config";
|
|
9
9
|
import { jsonValueSchema } from "@alpacakit/core";
|
|
10
10
|
import { z } from "zod";
|
|
11
|
-
import { ADD_AGENT_CONFIG_RESULT, ADD_API_KEY_PROFILE_RESULT, LOGIN_MANAGED_HOME_RESULT, } from "./register.js";
|
|
12
11
|
import { INVALID_NAME_RESULT_KIND } from "./names.js";
|
|
12
|
+
import { ADD_AGENT_CONFIG_RESULT, ADD_API_KEY_PROFILE_RESULT, LOGIN_MANAGED_HOME_RESULT, } from "./register.js";
|
|
13
13
|
import { REMOVE_AGENTS_HOME_ENTRY_RESULT } from "./remove.js";
|
|
14
14
|
const RESULT_DISCRIMINATOR = "kind";
|
|
15
15
|
const AVAILABILITY_DISCRIMINATOR = "status";
|