@commonlyai/cli 0.1.246 → 0.1.247
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/package.json +1 -1
- package/src/commands/agent.js +10 -10
- package/src/lib/adapters/index.js +4 -0
package/package.json
CHANGED
package/src/commands/agent.js
CHANGED
|
@@ -37,7 +37,7 @@ import { getToken, resolveInstanceUrl } from '../lib/config.js';
|
|
|
37
37
|
import { startPoller, terminalDeliveryAckError } from '../lib/poller.js';
|
|
38
38
|
import { formatDigestFrame } from '../lib/digest-frame.js';
|
|
39
39
|
import { startWebhookServer, forwardToLocalWebhook, logOnlyHandler } from '../lib/webhook-server.js';
|
|
40
|
-
import { getAdapter, listAdapterNames } from '../lib/adapters/index.js';
|
|
40
|
+
import { getAdapter, listAdapterNames, listPublicAdapterNames } from '../lib/adapters/index.js';
|
|
41
41
|
import {
|
|
42
42
|
getSession,
|
|
43
43
|
getSessionEntry,
|
|
@@ -388,7 +388,7 @@ export const bootstrapAgentRecordFromEnv = async ({
|
|
|
388
388
|
name,
|
|
389
389
|
env = process.env,
|
|
390
390
|
clientFactory = createClient,
|
|
391
|
-
adapterRegistry = { getAdapter, listAdapterNames },
|
|
391
|
+
adapterRegistry = { getAdapter, listAdapterNames, listPublicAdapterNames },
|
|
392
392
|
adapterOverride = null,
|
|
393
393
|
log = () => {},
|
|
394
394
|
startDir = process.cwd(),
|
|
@@ -424,7 +424,7 @@ export const bootstrapAgentRecordFromEnv = async ({
|
|
|
424
424
|
if (adapterOverride) {
|
|
425
425
|
const adapter = adapterRegistry.getAdapter(adapterOverride);
|
|
426
426
|
if (!adapter) {
|
|
427
|
-
throw new Error(`Unknown adapter '${adapterOverride}'. Known: ${adapterRegistry.listAdapterNames().join(', ')}`);
|
|
427
|
+
throw new Error(`Unknown adapter '${adapterOverride}'. Known: ${(adapterRegistry.listPublicAdapterNames || adapterRegistry.listAdapterNames)().join(', ')}`);
|
|
428
428
|
}
|
|
429
429
|
if (!await adapter.detect()) {
|
|
430
430
|
throw new Error(`Adapter '${adapterOverride}' not found on PATH.`);
|
|
@@ -977,7 +977,7 @@ export const updateAgentConfiguration = async ({
|
|
|
977
977
|
envPath = null,
|
|
978
978
|
runtimeKey = false,
|
|
979
979
|
parseEnv = parseEnvironmentFile,
|
|
980
|
-
adapterRegistry = { getAdapter, listAdapterNames },
|
|
980
|
+
adapterRegistry = { getAdapter, listAdapterNames, listPublicAdapterNames },
|
|
981
981
|
}) => {
|
|
982
982
|
if (!record?.agentName) {
|
|
983
983
|
throw new Error('token record is missing agentName — re-attach the agent');
|
|
@@ -1007,7 +1007,7 @@ export const updateAgentConfiguration = async ({
|
|
|
1007
1007
|
const selectedAdapter = adapterRegistry.getAdapter(normalizedAdapter);
|
|
1008
1008
|
if (!selectedAdapter || !knownAdapters.includes(normalizedAdapter)) {
|
|
1009
1009
|
throw new Error(
|
|
1010
|
-
`Unknown adapter '${normalizedAdapter}'. Known: ${
|
|
1010
|
+
`Unknown adapter '${normalizedAdapter}'. Known: ${(adapterRegistry.listPublicAdapterNames || adapterRegistry.listAdapterNames)().join(', ')}`,
|
|
1011
1011
|
);
|
|
1012
1012
|
}
|
|
1013
1013
|
if (!await selectedAdapter.detect()) {
|
|
@@ -1176,7 +1176,7 @@ export const performAttach = async ({
|
|
|
1176
1176
|
memoryFrom = null,
|
|
1177
1177
|
memoryInstance = 'default',
|
|
1178
1178
|
log = () => {},
|
|
1179
|
-
adapterRegistry = { getAdapter, listAdapterNames },
|
|
1179
|
+
adapterRegistry = { getAdapter, listAdapterNames, listPublicAdapterNames },
|
|
1180
1180
|
seatbelt: probeSeatbelt = detectSeatbelt,
|
|
1181
1181
|
bwrap: probeBwrap = detectBwrap,
|
|
1182
1182
|
platform = process.platform,
|
|
@@ -1184,7 +1184,7 @@ export const performAttach = async ({
|
|
|
1184
1184
|
const adapter = adapterRegistry.getAdapter(adapterName);
|
|
1185
1185
|
if (!adapter) {
|
|
1186
1186
|
throw new Error(
|
|
1187
|
-
`Unknown adapter "${adapterName}". Known: ${adapterRegistry.listAdapterNames().join(', ')}`,
|
|
1187
|
+
`Unknown adapter "${adapterName}". Known: ${(adapterRegistry.listPublicAdapterNames || adapterRegistry.listAdapterNames)().join(', ')}`,
|
|
1188
1188
|
);
|
|
1189
1189
|
}
|
|
1190
1190
|
|
|
@@ -4090,7 +4090,7 @@ Docs:
|
|
|
4090
4090
|
// ── attach (ADR-005, ADR-008) ─────────────────────────────────────────────
|
|
4091
4091
|
agent
|
|
4092
4092
|
.command('attach <adapter>')
|
|
4093
|
-
.description(
|
|
4093
|
+
.description(`Wrap a local CLI as a Commonly agent (${listPublicAdapterNames().join('|')})`)
|
|
4094
4094
|
.requiredOption('--pod <podId>', 'Pod ID to install into')
|
|
4095
4095
|
.requiredOption('--name <name>', 'Agent name (e.g. my-claude)')
|
|
4096
4096
|
.option('--memory-from <agent>', 'Copy long-term memory from a hosted agent you own')
|
|
@@ -4276,7 +4276,7 @@ Docs:
|
|
|
4276
4276
|
.command('run <name>')
|
|
4277
4277
|
.description('Run the local-CLI wrapper loop for an attached agent')
|
|
4278
4278
|
.option('--interval <ms>', 'Poll interval in ms', '5000')
|
|
4279
|
-
.option('--adapter <name>',
|
|
4279
|
+
.option('--adapter <name>', `CLI to wrap on first-run bootstrap (${listPublicAdapterNames().join('|')}); an existing token file bound to a different adapter stops the run`)
|
|
4280
4280
|
.option('--cascade-cap <n>', `Consecutive agent-triggered turns allowed per pod (env ${CASCADE_ENV_VARS.cap}, default ${CASCADE_DEFAULTS.cap})`)
|
|
4281
4281
|
.option('--cascade-grace <n>', `Extra turns allowed when this seat was directly addressed; 0 disables the grace (env ${CASCADE_ENV_VARS.addressedGrace}, default ${CASCADE_DEFAULTS.addressedGrace})`)
|
|
4282
4282
|
.option('--cascade-reset <ms>', `Silence window that clears the streak (env ${CASCADE_ENV_VARS.resetMs}, default ${CASCADE_DEFAULTS.resetMs})`)
|
|
@@ -4375,7 +4375,7 @@ Docs:
|
|
|
4375
4375
|
|
|
4376
4376
|
const adapter = getAdapter(record.adapter);
|
|
4377
4377
|
if (!adapter) {
|
|
4378
|
-
console.error(`Unknown adapter '${record.adapter}' in token file. Known: ${
|
|
4378
|
+
console.error(`Unknown adapter '${record.adapter}' in token file. Known: ${listPublicAdapterNames().join(', ')}`);
|
|
4379
4379
|
process.exit(1);
|
|
4380
4380
|
}
|
|
4381
4381
|
|
|
@@ -31,6 +31,10 @@ const ADAPTERS = {
|
|
|
31
31
|
|
|
32
32
|
export const listAdapterNames = () => Object.keys(ADAPTERS);
|
|
33
33
|
|
|
34
|
+
// The adapters a person can choose: every one but the internal test stub. Help
|
|
35
|
+
// text and "Known:" lists read this, so they never drift from the registry.
|
|
36
|
+
export const listPublicAdapterNames = () => listAdapterNames().filter((name) => name !== stub.name);
|
|
37
|
+
|
|
34
38
|
export const getAdapter = (name) => ADAPTERS[name] || null;
|
|
35
39
|
|
|
36
40
|
/**
|