@aisac/cli 0.4.0-beta.22 → 0.4.0-beta.24
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 +13 -3
- package/dist/claude-observation.mjs +1 -1
- package/dist/cli.mjs +7 -3
- package/dist/engineering.mjs +43 -5
- package/dist/launch.mjs +39 -10
- package/dist/manager/bus.mjs +30 -2
- package/dist/manager/launch-role.mjs +70 -24
- package/dist/manager/messages.mjs +3 -1
- package/dist/manager/native-worker.mjs +338 -0
- package/dist/manager/server.mjs +63 -12
- package/dist/manager/status.mjs +3 -3
- package/dist/manager/workers-cli.mjs +76 -14
- package/dist/package.json +1 -1
- package/dist/release-manifest.json +7 -7
- package/dist/token-guide.mjs +5 -0
- package/package.json +1 -1
|
@@ -17,6 +17,8 @@ import {
|
|
|
17
17
|
WORKER_ROLE_ENV,
|
|
18
18
|
audit,
|
|
19
19
|
ensurePrivateDirectory,
|
|
20
|
+
isBusWorker,
|
|
21
|
+
isNativeWorker,
|
|
20
22
|
listRooms,
|
|
21
23
|
listSessions,
|
|
22
24
|
mailboxDirectory,
|
|
@@ -28,6 +30,7 @@ import {
|
|
|
28
30
|
withRoomLock,
|
|
29
31
|
} from './bus.mjs';
|
|
30
32
|
import { listMailbox } from './messages.mjs';
|
|
33
|
+
import { roomTag, workerPeerName } from './native-worker.mjs';
|
|
31
34
|
import {
|
|
32
35
|
buildGrant,
|
|
33
36
|
listGrants,
|
|
@@ -97,7 +100,9 @@ import { createDirectoryWatch } from './watch.mjs';
|
|
|
97
100
|
* @property {'manager' | 'worker'} role
|
|
98
101
|
* @property {'claude' | 'codex'} host
|
|
99
102
|
* @property {string | null} hostVersion
|
|
100
|
-
* @property {
|
|
103
|
+
* @property {'bus' | 'native'} channel `native`: a Claude Code worker, reached over Claude Code's own session messaging (FR14)
|
|
104
|
+
* @property {string | null} address a native worker's session name, what a sender writes to; null otherwise, and when the room's label is gone
|
|
105
|
+
* @property {SessionRecord['state'] | null} state null for a native worker: the room knows no state for it
|
|
101
106
|
* @property {number} stateSince
|
|
102
107
|
* @property {SessionRecord['approval']} approval
|
|
103
108
|
* @property {SessionRecord['turnOrigin']} turnOrigin
|
|
@@ -204,9 +209,18 @@ const EN = {
|
|
|
204
209
|
/** @param {string} names @param {string} room @param {string} live */
|
|
205
210
|
workerNotFound: (names, room, live) =>
|
|
206
211
|
`no live worker named ${names} in room ${room}; live workers: ${live}.`,
|
|
212
|
+
/** @param {string} names */
|
|
213
|
+
nativeWorker: (names) =>
|
|
214
|
+
`${names}: a Claude Code worker talks through Claude Code's own session messaging; its approval prompts are answered in its terminal and cannot be delegated. Nothing was granted.`,
|
|
215
|
+
/** @param {string} address */
|
|
216
|
+
nativeChannel: (address) => `Claude Code session messaging, as "${address}"`,
|
|
217
|
+
nativeChannelUnnamed: 'Claude Code session messaging',
|
|
207
218
|
none: 'none',
|
|
208
219
|
/** @param {string} room */
|
|
209
220
|
noLiveWorker: (room) => `no live worker in room ${room}; nothing was granted.`,
|
|
221
|
+
/** @param {string} room */
|
|
222
|
+
onlyNativeWorkers: (room) =>
|
|
223
|
+
`no live Codex worker in room ${room}: a Claude Code worker's approval prompts are answered in its terminal and cannot be delegated; nothing was granted.`,
|
|
210
224
|
kindRepository: 'repository',
|
|
211
225
|
kindNamed: 'named',
|
|
212
226
|
/** @param {string} room @param {number} count */
|
|
@@ -215,6 +229,7 @@ const EN = {
|
|
|
215
229
|
emptyRoom: (room) => `No live sessions in room ${room}.`,
|
|
216
230
|
roles: { manager: 'manager', worker: 'worker' },
|
|
217
231
|
labels: {
|
|
232
|
+
channel: 'channel',
|
|
218
233
|
state: 'state',
|
|
219
234
|
turn: 'turn',
|
|
220
235
|
approval: 'approval',
|
|
@@ -322,8 +337,14 @@ const PT_BR = {
|
|
|
322
337
|
},
|
|
323
338
|
workerNotFound: (names, room, live) =>
|
|
324
339
|
`nenhum worker ativo chamado ${names} na sala ${room}; workers ativos: ${live}.`,
|
|
340
|
+
nativeWorker: (names) =>
|
|
341
|
+
`${names}: um worker Claude Code conversa pelo canal de mensagens do próprio Claude Code; os pedidos de aprovação dele são respondidos no terminal dele e não podem ser delegados. Nada foi delegado.`,
|
|
342
|
+
nativeChannel: (address) => `mensagens entre sessões do Claude Code, como "${address}"`,
|
|
343
|
+
nativeChannelUnnamed: 'mensagens entre sessões do Claude Code',
|
|
325
344
|
none: 'nenhum',
|
|
326
345
|
noLiveWorker: (room) => `nenhum worker ativo na sala ${room}; nada foi delegado.`,
|
|
346
|
+
onlyNativeWorkers: (room) =>
|
|
347
|
+
`nenhum worker Codex ativo na sala ${room}: os pedidos de aprovação de um worker Claude Code são respondidos no terminal dele e não podem ser delegados; nada foi delegado.`,
|
|
327
348
|
kindRepository: 'repositório',
|
|
328
349
|
kindNamed: 'nomeada',
|
|
329
350
|
listHeader: (room, count) =>
|
|
@@ -331,6 +352,7 @@ const PT_BR = {
|
|
|
331
352
|
emptyRoom: (room) => `Nenhuma sessão ativa na sala ${room}.`,
|
|
332
353
|
roles: { manager: 'gerente', worker: 'worker' },
|
|
333
354
|
labels: {
|
|
355
|
+
channel: 'canal',
|
|
334
356
|
state: 'estado',
|
|
335
357
|
turn: 'turno',
|
|
336
358
|
approval: 'aprovação',
|
|
@@ -731,15 +753,19 @@ async function sweptSessions(context, io) {
|
|
|
731
753
|
* @param {SessionRecord} record
|
|
732
754
|
* @param {number} queued
|
|
733
755
|
* @param {number | null} delegatedUntil
|
|
756
|
+
* @param {string | null} roomLabel
|
|
734
757
|
* @returns {SessionView}
|
|
735
758
|
*/
|
|
736
|
-
function sessionView(record, queued, delegatedUntil) {
|
|
759
|
+
function sessionView(record, queued, delegatedUntil, roomLabel) {
|
|
760
|
+
const native = isNativeWorker(record);
|
|
737
761
|
return {
|
|
738
762
|
name: record.name,
|
|
739
763
|
role: record.role,
|
|
740
764
|
host: record.host,
|
|
741
765
|
hostVersion: record.hostVersion,
|
|
742
|
-
|
|
766
|
+
channel: native ? 'native' : 'bus',
|
|
767
|
+
address: native && roomLabel !== null ? workerPeerName(record.name, roomTag(roomLabel)) : null,
|
|
768
|
+
state: native ? null : record.state,
|
|
743
769
|
stateSince: record.stateSince,
|
|
744
770
|
approval: record.approval,
|
|
745
771
|
turnOrigin: record.turnOrigin,
|
|
@@ -752,7 +778,7 @@ function sessionView(record, queued, delegatedUntil) {
|
|
|
752
778
|
};
|
|
753
779
|
}
|
|
754
780
|
|
|
755
|
-
/** @param {SessionView} view @param {number} now @param {Messages} text */
|
|
781
|
+
/** @param {SessionView & { state: SessionRecord['state'] }} view @param {number} now @param {Messages} text */
|
|
756
782
|
function stateText(view, now, text) {
|
|
757
783
|
const since = text.since(
|
|
758
784
|
view.state,
|
|
@@ -784,18 +810,38 @@ function delegationText(view, now, text) {
|
|
|
784
810
|
);
|
|
785
811
|
}
|
|
786
812
|
|
|
787
|
-
/**
|
|
788
|
-
|
|
789
|
-
|
|
813
|
+
/**
|
|
814
|
+
* The rows of one session. A Claude Code worker has a channel and a directory:
|
|
815
|
+
* the room knows no state, sandbox, queue or delegation for it (FR14).
|
|
816
|
+
* @param {SessionView} view @param {number} now @param {Messages} text
|
|
817
|
+
* @returns {[string, string][]}
|
|
818
|
+
*/
|
|
819
|
+
function sessionRows(view, now, text) {
|
|
820
|
+
const { state } = view;
|
|
821
|
+
if (state === null)
|
|
822
|
+
return [
|
|
823
|
+
[
|
|
824
|
+
text.labels.channel,
|
|
825
|
+
view.address === null ? text.nativeChannelUnnamed : text.nativeChannel(view.address),
|
|
826
|
+
],
|
|
827
|
+
[text.labels.directory, safe(view.cwd)],
|
|
828
|
+
];
|
|
790
829
|
/** @type {[string, string][]} */
|
|
791
830
|
const rows = [
|
|
792
|
-
[text.labels.state, stateText(view, now, text)],
|
|
831
|
+
[text.labels.state, stateText({ ...view, state }, now, text)],
|
|
793
832
|
...detailRows(view, text),
|
|
794
833
|
[text.labels.directory, safe(view.cwd)],
|
|
795
834
|
[text.labels.sandbox, text.sandboxValue(safe(view.sandbox), safe(view.approvalPolicy))],
|
|
796
835
|
[text.labels.queued, text.queuedValue(view.queued)],
|
|
797
836
|
];
|
|
798
837
|
if (view.role === 'worker') rows.push([text.labels.delegation, delegationText(view, now, text)]);
|
|
838
|
+
return rows;
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
/** @param {SessionView} view @param {number} now @param {Messages} text */
|
|
842
|
+
function sessionBlock(view, now, text) {
|
|
843
|
+
const version = view.hostVersion === null ? '' : ` ${safe(view.hostVersion)}`;
|
|
844
|
+
const rows = sessionRows(view, now, text);
|
|
799
845
|
const width = Math.max(...Object.values(text.labels).map((label) => label.length)) + LABEL_GAP;
|
|
800
846
|
return [
|
|
801
847
|
`${view.name} (${text.roles[view.role]}, ${HOST_NAMES[view.host]}${version})`,
|
|
@@ -817,7 +863,9 @@ async function listCommand(context, options, io) {
|
|
|
817
863
|
const views = [];
|
|
818
864
|
for (const record of sessions) {
|
|
819
865
|
const { names } = await listMailbox(context.paths, 'inbox', recipientOf(record));
|
|
820
|
-
views.push(
|
|
866
|
+
views.push(
|
|
867
|
+
sessionView(record, names.length, grants.get(record.sessionId) ?? null, context.room.label),
|
|
868
|
+
);
|
|
821
869
|
}
|
|
822
870
|
if (options.json) {
|
|
823
871
|
io.out(jsonLine({ room: context.room, sessions: views }));
|
|
@@ -974,12 +1022,24 @@ async function delegateCommand(context, options, io) {
|
|
|
974
1022
|
const text = MESSAGES[io.locale];
|
|
975
1023
|
const now = nowOf(io);
|
|
976
1024
|
const sessions = await sweptSessions(context, io);
|
|
977
|
-
|
|
1025
|
+
// A Claude Code worker has no adapter to hold a request: it is never a target (FR14).
|
|
1026
|
+
const native = sessions
|
|
1027
|
+
.filter(isNativeWorker)
|
|
1028
|
+
.filter((entry) => options.names.includes(entry.name));
|
|
1029
|
+
if (native.length > 0)
|
|
1030
|
+
throw new WorkersError('worker_native_channel', {
|
|
1031
|
+
hint: text.nativeWorker(nameList(native.map((entry) => entry.name))),
|
|
1032
|
+
});
|
|
1033
|
+
const workers = sessions.filter(isBusWorker);
|
|
978
1034
|
const targets = pickWorkers(workers, options.names, context, text);
|
|
979
|
-
if (targets.length === 0)
|
|
1035
|
+
if (targets.length === 0) {
|
|
1036
|
+
const title = roomTitle(context.room, text);
|
|
980
1037
|
throw new WorkersError('no_live_worker', {
|
|
981
|
-
hint:
|
|
1038
|
+
hint: sessions.some(isNativeWorker)
|
|
1039
|
+
? text.onlyNativeWorkers(title)
|
|
1040
|
+
: text.noLiveWorker(title),
|
|
982
1041
|
});
|
|
1042
|
+
}
|
|
983
1043
|
const shownAt = now();
|
|
984
1044
|
const current = new Map(
|
|
985
1045
|
(await listGrants(context.paths, shownAt)).map((grant) => [
|
|
@@ -1072,8 +1132,10 @@ async function writeGrants(context, targets, durationMs, io) {
|
|
|
1072
1132
|
async function revokeCommand(context, options, io) {
|
|
1073
1133
|
const text = MESSAGES[io.locale];
|
|
1074
1134
|
const sessions = await sweptSessions(context, io);
|
|
1075
|
-
const workers = sessions.filter(
|
|
1076
|
-
|
|
1135
|
+
const workers = sessions.filter(isBusWorker);
|
|
1136
|
+
// A Claude Code worker is a live worker without a grant: naming it ends nothing (FR14).
|
|
1137
|
+
const live = sessions.filter((entry) => entry.role === 'worker');
|
|
1138
|
+
const unknown = options.names.filter((name) => !live.some((worker) => worker.name === name));
|
|
1077
1139
|
const targets =
|
|
1078
1140
|
options.names.length === 0
|
|
1079
1141
|
? workers
|
package/dist/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"kind": "aisac-release-manifest",
|
|
3
3
|
"schema_version": 1,
|
|
4
|
-
"sequence":
|
|
5
|
-
"issued_at": "2026-11-
|
|
6
|
-
"expires_at": "2026-12-
|
|
4
|
+
"sequence": 4,
|
|
5
|
+
"issued_at": "2026-11-16T21:45:00Z",
|
|
6
|
+
"expires_at": "2026-12-16T21:45:00Z",
|
|
7
7
|
"key_id": "94f9ccf331e4f7f3",
|
|
8
8
|
"features": {
|
|
9
9
|
"self_update": true,
|
|
@@ -20,10 +20,10 @@
|
|
|
20
20
|
"minimum_version": "0.4.0-beta.18",
|
|
21
21
|
"channels": {
|
|
22
22
|
"beta": {
|
|
23
|
-
"version": "0.4.0-beta.
|
|
23
|
+
"version": "0.4.0-beta.23",
|
|
24
24
|
"integrity": {
|
|
25
|
-
"@aisac/cli": "sha512-
|
|
26
|
-
"@brunobracaioli/aibrain": "sha512-
|
|
25
|
+
"@aisac/cli": "sha512-fscT+cQuVlsG5AATN3BLLyORkRtfd8b56MfO4wzLaBVA4dWGyQTHrwBL1tRgB+185s89YGT5GEv41gCsrkoxsg==",
|
|
26
|
+
"@brunobracaioli/aibrain": "sha512-7gMuflNfStQ1WqFWUBXzzVsbLp0TF4TjrdFoJa+ekuZA5WUPeCA6tdPNOLW/HQOFUtY4cb0KbXXUXf/iEIhW3A=="
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -324,5 +324,5 @@
|
|
|
324
324
|
}
|
|
325
325
|
}
|
|
326
326
|
},
|
|
327
|
-
"signature": "
|
|
327
|
+
"signature": "/SiCDyvo99W4Y9Kgr2JblS4Z0Vh4ypVYudKJvpB6JMAKUK9G89+aO29Z9wAbPNasQJ50/TC52tz6dsggyXqkDQ=="
|
|
328
328
|
}
|
package/dist/token-guide.mjs
CHANGED
|
@@ -29,6 +29,8 @@ const TEXT = Object.freeze({
|
|
|
29
29
|
'pt-BR': {
|
|
30
30
|
intro: 'O aisac precisa de um token pessoal (PAT) do seu AI Brain.',
|
|
31
31
|
missing: 'Não tem um? Gere em um minuto:',
|
|
32
|
+
mothership:
|
|
33
|
+
' Entrou pelo AISAC Mothership? O link "AI Brain" do chat já abre o painel com a sessão feita; siga do passo 2.',
|
|
32
34
|
login: (/** @type {string} */ url) =>
|
|
33
35
|
` 1. Abra ${url} e entre com o MESMO e-mail usado na compra\n (chega um código de 6 dígitos). A licença fica vinculada a esse e-mail.`,
|
|
34
36
|
label:
|
|
@@ -56,6 +58,8 @@ const TEXT = Object.freeze({
|
|
|
56
58
|
en: {
|
|
57
59
|
intro: 'aisac needs a personal access token (PAT) from your AI Brain.',
|
|
58
60
|
missing: "Don't have one? Create it in a minute:",
|
|
61
|
+
mothership:
|
|
62
|
+
' Signed up through the AISAC Mothership? The "AI Brain" link in the chat opens the dashboard already signed in; continue from step 2.',
|
|
59
63
|
login: (/** @type {string} */ url) =>
|
|
60
64
|
` 1. Open ${url} and sign in with the SAME email you used to buy\n (a 6-digit code arrives by email). The license is tied to that email.`,
|
|
61
65
|
label:
|
|
@@ -97,6 +101,7 @@ function steps(locale, endpoint, step) {
|
|
|
97
101
|
return [
|
|
98
102
|
text.intro,
|
|
99
103
|
text.missing,
|
|
104
|
+
text.mothership,
|
|
100
105
|
text.login(dashboardUrl(endpoint)),
|
|
101
106
|
text.label,
|
|
102
107
|
text.generate,
|
package/package.json
CHANGED