@anhlp/alp-runtime 0.0.1-beta.3 → 0.0.1-beta.5
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/dist/acp-transport.js +5 -36
- package/dist/antigravity-transport.d.ts +17 -0
- package/dist/antigravity-transport.js +82 -58
- package/dist/assignment-results.d.ts +52 -0
- package/dist/assignment-results.js +169 -0
- package/dist/attachments.d.ts +84 -0
- package/dist/attachments.js +213 -0
- package/dist/board-domain.js +2 -2
- package/dist/board.d.ts +6 -0
- package/dist/board.js +7 -0
- package/dist/catalog.d.ts +13 -0
- package/dist/catalog.js +9 -1
- package/dist/claude-transport.d.ts +35 -0
- package/dist/claude-transport.js +152 -10
- package/dist/compact.d.ts +29 -0
- package/dist/compact.js +49 -0
- package/dist/configure.d.ts +44 -0
- package/dist/configure.js +64 -0
- package/dist/contracts.d.ts +185 -4
- package/dist/contracts.js +11 -0
- package/dist/conversation.d.ts +45 -0
- package/dist/conversation.js +62 -0
- package/dist/index.d.ts +15 -4
- package/dist/index.js +40 -3
- package/dist/input-limits.d.ts +25 -0
- package/dist/input-limits.js +48 -0
- package/dist/language.d.ts +8 -0
- package/dist/language.js +20 -0
- package/dist/mailbox.d.ts +2 -0
- package/dist/mailbox.js +3 -1
- package/dist/mcp-tools.d.ts +8 -0
- package/dist/mcp-tools.js +26 -0
- package/dist/model-catalog.d.ts +76 -0
- package/dist/model-catalog.js +193 -0
- package/dist/model-probes.d.ts +7 -0
- package/dist/model-probes.js +69 -0
- package/dist/providers.js +2 -0
- package/dist/resolve.d.ts +1 -0
- package/dist/resolve.js +3 -1
- package/dist/runtime.d.ts +9 -0
- package/dist/runtime.js +1547 -142
- package/dist/session-config.d.ts +279 -0
- package/dist/session-config.js +10 -10
- package/dist/session-state.d.ts +44 -6
- package/dist/tools.d.ts +119 -0
- package/dist/tools.js +72 -5
- package/dist/transport.js +3 -1
- package/dist/workspace.d.ts +11 -4
- package/dist/workspace.js +29 -11
- package/dist/worktree-domain.d.ts +2 -1
- package/dist/worktree-domain.js +4 -1
- package/package.json +11 -3
- package/src/acp-transport.ts +7 -37
- package/src/antigravity-transport.ts +95 -53
- package/src/assignment-results.ts +146 -0
- package/src/attachments.ts +254 -0
- package/src/board-domain.ts +2 -2
- package/src/board.ts +7 -0
- package/src/catalog.ts +10 -1
- package/src/claude-transport.ts +171 -11
- package/src/compact.ts +62 -0
- package/src/configure.ts +93 -0
- package/src/contracts.ts +172 -5
- package/src/conversation.ts +81 -0
- package/src/index.ts +15 -4
- package/src/input-limits.ts +65 -0
- package/src/language.ts +18 -0
- package/src/mailbox.ts +4 -1
- package/src/mcp-tools.ts +33 -0
- package/src/model-catalog.ts +166 -0
- package/src/model-probes.ts +58 -0
- package/src/providers.ts +3 -0
- package/src/resolve.ts +4 -2
- package/src/runtime.ts +1681 -151
- package/src/session-config.ts +9 -9
- package/src/session-state.ts +29 -2
- package/src/tools.ts +69 -5
- package/src/transport.ts +3 -1
- package/src/workspace.ts +42 -15
- package/src/worktree-domain.ts +5 -1
package/dist/session-config.d.ts
CHANGED
|
@@ -268,7 +268,9 @@ export declare function nativeSessionConfig(runtimeKind: RuntimeKind, mapping: R
|
|
|
268
268
|
type: string;
|
|
269
269
|
items: {
|
|
270
270
|
type: string;
|
|
271
|
+
maxLength: number;
|
|
271
272
|
};
|
|
273
|
+
maxItems: number;
|
|
272
274
|
description: string;
|
|
273
275
|
};
|
|
274
276
|
};
|
|
@@ -288,6 +290,7 @@ export declare function nativeSessionConfig(runtimeKind: RuntimeKind, mapping: R
|
|
|
288
290
|
type: string;
|
|
289
291
|
enum: readonly ["claim", "decision", "finding"];
|
|
290
292
|
};
|
|
293
|
+
maxItems: 3;
|
|
291
294
|
};
|
|
292
295
|
limit: {
|
|
293
296
|
type: string;
|
|
@@ -355,6 +358,51 @@ export declare function nativeSessionConfig(runtimeKind: RuntimeKind, mapping: R
|
|
|
355
358
|
required: string[];
|
|
356
359
|
additionalProperties: boolean;
|
|
357
360
|
};
|
|
361
|
+
} | {
|
|
362
|
+
type: string;
|
|
363
|
+
name: string;
|
|
364
|
+
description: string;
|
|
365
|
+
inputSchema: {
|
|
366
|
+
type: string;
|
|
367
|
+
properties: {
|
|
368
|
+
changes: {
|
|
369
|
+
type: string;
|
|
370
|
+
description: string;
|
|
371
|
+
items: {
|
|
372
|
+
type: string;
|
|
373
|
+
properties: {
|
|
374
|
+
scope: {
|
|
375
|
+
type: string;
|
|
376
|
+
enum: string[];
|
|
377
|
+
};
|
|
378
|
+
remove: {
|
|
379
|
+
type: string;
|
|
380
|
+
items: {
|
|
381
|
+
type: string;
|
|
382
|
+
};
|
|
383
|
+
description: string;
|
|
384
|
+
};
|
|
385
|
+
add: {
|
|
386
|
+
type: string;
|
|
387
|
+
description: string;
|
|
388
|
+
};
|
|
389
|
+
reason: {
|
|
390
|
+
type: string;
|
|
391
|
+
description: string;
|
|
392
|
+
};
|
|
393
|
+
};
|
|
394
|
+
required: string[];
|
|
395
|
+
additionalProperties: boolean;
|
|
396
|
+
};
|
|
397
|
+
};
|
|
398
|
+
requestId: {
|
|
399
|
+
type: string;
|
|
400
|
+
description: string;
|
|
401
|
+
};
|
|
402
|
+
};
|
|
403
|
+
required: string[];
|
|
404
|
+
additionalProperties: boolean;
|
|
405
|
+
};
|
|
358
406
|
} | {
|
|
359
407
|
type: string;
|
|
360
408
|
name: string;
|
|
@@ -576,6 +624,15 @@ export declare function nativeSessionConfig(runtimeKind: RuntimeKind, mapping: R
|
|
|
576
624
|
type: string;
|
|
577
625
|
description: string;
|
|
578
626
|
} | undefined;
|
|
627
|
+
options?: {
|
|
628
|
+
type: string;
|
|
629
|
+
items: {
|
|
630
|
+
type: string;
|
|
631
|
+
maxLength: number;
|
|
632
|
+
};
|
|
633
|
+
maxItems: number;
|
|
634
|
+
description: string;
|
|
635
|
+
} | undefined;
|
|
579
636
|
gate?: {
|
|
580
637
|
type: string;
|
|
581
638
|
description: string;
|
|
@@ -588,6 +645,7 @@ export declare function nativeSessionConfig(runtimeKind: RuntimeKind, mapping: R
|
|
|
588
645
|
type: string;
|
|
589
646
|
additionalProperties: {
|
|
590
647
|
type: string;
|
|
648
|
+
maxLength: number;
|
|
591
649
|
};
|
|
592
650
|
description: string;
|
|
593
651
|
} | undefined;
|
|
@@ -615,6 +673,41 @@ export declare function nativeSessionConfig(runtimeKind: RuntimeKind, mapping: R
|
|
|
615
673
|
required: string[];
|
|
616
674
|
additionalProperties: boolean;
|
|
617
675
|
};
|
|
676
|
+
} | {
|
|
677
|
+
type: string;
|
|
678
|
+
name: string;
|
|
679
|
+
description: string;
|
|
680
|
+
inputSchema: {
|
|
681
|
+
type: string;
|
|
682
|
+
properties: {
|
|
683
|
+
action: {
|
|
684
|
+
type: string;
|
|
685
|
+
enum: string[];
|
|
686
|
+
};
|
|
687
|
+
dueAt: {
|
|
688
|
+
type: string;
|
|
689
|
+
description: string;
|
|
690
|
+
};
|
|
691
|
+
prompt: {
|
|
692
|
+
type: string;
|
|
693
|
+
description: string;
|
|
694
|
+
};
|
|
695
|
+
requestId: {
|
|
696
|
+
type: string;
|
|
697
|
+
description: string;
|
|
698
|
+
};
|
|
699
|
+
id: {
|
|
700
|
+
type: string;
|
|
701
|
+
description: string;
|
|
702
|
+
};
|
|
703
|
+
status: {
|
|
704
|
+
type: string;
|
|
705
|
+
enum: string[];
|
|
706
|
+
};
|
|
707
|
+
};
|
|
708
|
+
required: string[];
|
|
709
|
+
additionalProperties: boolean;
|
|
710
|
+
};
|
|
618
711
|
} | {
|
|
619
712
|
type: string;
|
|
620
713
|
name: string;
|
|
@@ -918,7 +1011,9 @@ export declare function nativeSessionConfig(runtimeKind: RuntimeKind, mapping: R
|
|
|
918
1011
|
type: string;
|
|
919
1012
|
items: {
|
|
920
1013
|
type: string;
|
|
1014
|
+
maxLength: number;
|
|
921
1015
|
};
|
|
1016
|
+
maxItems: number;
|
|
922
1017
|
description: string;
|
|
923
1018
|
};
|
|
924
1019
|
};
|
|
@@ -938,6 +1033,7 @@ export declare function nativeSessionConfig(runtimeKind: RuntimeKind, mapping: R
|
|
|
938
1033
|
type: string;
|
|
939
1034
|
enum: readonly ["claim", "decision", "finding"];
|
|
940
1035
|
};
|
|
1036
|
+
maxItems: 3;
|
|
941
1037
|
};
|
|
942
1038
|
limit: {
|
|
943
1039
|
type: string;
|
|
@@ -1005,6 +1101,51 @@ export declare function nativeSessionConfig(runtimeKind: RuntimeKind, mapping: R
|
|
|
1005
1101
|
required: string[];
|
|
1006
1102
|
additionalProperties: boolean;
|
|
1007
1103
|
};
|
|
1104
|
+
} | {
|
|
1105
|
+
type: string;
|
|
1106
|
+
name: string;
|
|
1107
|
+
description: string;
|
|
1108
|
+
inputSchema: {
|
|
1109
|
+
type: string;
|
|
1110
|
+
properties: {
|
|
1111
|
+
changes: {
|
|
1112
|
+
type: string;
|
|
1113
|
+
description: string;
|
|
1114
|
+
items: {
|
|
1115
|
+
type: string;
|
|
1116
|
+
properties: {
|
|
1117
|
+
scope: {
|
|
1118
|
+
type: string;
|
|
1119
|
+
enum: string[];
|
|
1120
|
+
};
|
|
1121
|
+
remove: {
|
|
1122
|
+
type: string;
|
|
1123
|
+
items: {
|
|
1124
|
+
type: string;
|
|
1125
|
+
};
|
|
1126
|
+
description: string;
|
|
1127
|
+
};
|
|
1128
|
+
add: {
|
|
1129
|
+
type: string;
|
|
1130
|
+
description: string;
|
|
1131
|
+
};
|
|
1132
|
+
reason: {
|
|
1133
|
+
type: string;
|
|
1134
|
+
description: string;
|
|
1135
|
+
};
|
|
1136
|
+
};
|
|
1137
|
+
required: string[];
|
|
1138
|
+
additionalProperties: boolean;
|
|
1139
|
+
};
|
|
1140
|
+
};
|
|
1141
|
+
requestId: {
|
|
1142
|
+
type: string;
|
|
1143
|
+
description: string;
|
|
1144
|
+
};
|
|
1145
|
+
};
|
|
1146
|
+
required: string[];
|
|
1147
|
+
additionalProperties: boolean;
|
|
1148
|
+
};
|
|
1008
1149
|
} | {
|
|
1009
1150
|
type: string;
|
|
1010
1151
|
name: string;
|
|
@@ -1226,6 +1367,15 @@ export declare function nativeSessionConfig(runtimeKind: RuntimeKind, mapping: R
|
|
|
1226
1367
|
type: string;
|
|
1227
1368
|
description: string;
|
|
1228
1369
|
} | undefined;
|
|
1370
|
+
options?: {
|
|
1371
|
+
type: string;
|
|
1372
|
+
items: {
|
|
1373
|
+
type: string;
|
|
1374
|
+
maxLength: number;
|
|
1375
|
+
};
|
|
1376
|
+
maxItems: number;
|
|
1377
|
+
description: string;
|
|
1378
|
+
} | undefined;
|
|
1229
1379
|
gate?: {
|
|
1230
1380
|
type: string;
|
|
1231
1381
|
description: string;
|
|
@@ -1238,6 +1388,7 @@ export declare function nativeSessionConfig(runtimeKind: RuntimeKind, mapping: R
|
|
|
1238
1388
|
type: string;
|
|
1239
1389
|
additionalProperties: {
|
|
1240
1390
|
type: string;
|
|
1391
|
+
maxLength: number;
|
|
1241
1392
|
};
|
|
1242
1393
|
description: string;
|
|
1243
1394
|
} | undefined;
|
|
@@ -1265,6 +1416,41 @@ export declare function nativeSessionConfig(runtimeKind: RuntimeKind, mapping: R
|
|
|
1265
1416
|
required: string[];
|
|
1266
1417
|
additionalProperties: boolean;
|
|
1267
1418
|
};
|
|
1419
|
+
} | {
|
|
1420
|
+
type: string;
|
|
1421
|
+
name: string;
|
|
1422
|
+
description: string;
|
|
1423
|
+
inputSchema: {
|
|
1424
|
+
type: string;
|
|
1425
|
+
properties: {
|
|
1426
|
+
action: {
|
|
1427
|
+
type: string;
|
|
1428
|
+
enum: string[];
|
|
1429
|
+
};
|
|
1430
|
+
dueAt: {
|
|
1431
|
+
type: string;
|
|
1432
|
+
description: string;
|
|
1433
|
+
};
|
|
1434
|
+
prompt: {
|
|
1435
|
+
type: string;
|
|
1436
|
+
description: string;
|
|
1437
|
+
};
|
|
1438
|
+
requestId: {
|
|
1439
|
+
type: string;
|
|
1440
|
+
description: string;
|
|
1441
|
+
};
|
|
1442
|
+
id: {
|
|
1443
|
+
type: string;
|
|
1444
|
+
description: string;
|
|
1445
|
+
};
|
|
1446
|
+
status: {
|
|
1447
|
+
type: string;
|
|
1448
|
+
enum: string[];
|
|
1449
|
+
};
|
|
1450
|
+
};
|
|
1451
|
+
required: string[];
|
|
1452
|
+
additionalProperties: boolean;
|
|
1453
|
+
};
|
|
1268
1454
|
} | {
|
|
1269
1455
|
type: string;
|
|
1270
1456
|
name: string;
|
|
@@ -1570,7 +1756,9 @@ export declare function nativeSessionConfig(runtimeKind: RuntimeKind, mapping: R
|
|
|
1570
1756
|
type: string;
|
|
1571
1757
|
items: {
|
|
1572
1758
|
type: string;
|
|
1759
|
+
maxLength: number;
|
|
1573
1760
|
};
|
|
1761
|
+
maxItems: number;
|
|
1574
1762
|
description: string;
|
|
1575
1763
|
};
|
|
1576
1764
|
};
|
|
@@ -1590,6 +1778,7 @@ export declare function nativeSessionConfig(runtimeKind: RuntimeKind, mapping: R
|
|
|
1590
1778
|
type: string;
|
|
1591
1779
|
enum: readonly ["claim", "decision", "finding"];
|
|
1592
1780
|
};
|
|
1781
|
+
maxItems: 3;
|
|
1593
1782
|
};
|
|
1594
1783
|
limit: {
|
|
1595
1784
|
type: string;
|
|
@@ -1657,6 +1846,51 @@ export declare function nativeSessionConfig(runtimeKind: RuntimeKind, mapping: R
|
|
|
1657
1846
|
required: string[];
|
|
1658
1847
|
additionalProperties: boolean;
|
|
1659
1848
|
};
|
|
1849
|
+
} | {
|
|
1850
|
+
type: string;
|
|
1851
|
+
name: string;
|
|
1852
|
+
description: string;
|
|
1853
|
+
inputSchema: {
|
|
1854
|
+
type: string;
|
|
1855
|
+
properties: {
|
|
1856
|
+
changes: {
|
|
1857
|
+
type: string;
|
|
1858
|
+
description: string;
|
|
1859
|
+
items: {
|
|
1860
|
+
type: string;
|
|
1861
|
+
properties: {
|
|
1862
|
+
scope: {
|
|
1863
|
+
type: string;
|
|
1864
|
+
enum: string[];
|
|
1865
|
+
};
|
|
1866
|
+
remove: {
|
|
1867
|
+
type: string;
|
|
1868
|
+
items: {
|
|
1869
|
+
type: string;
|
|
1870
|
+
};
|
|
1871
|
+
description: string;
|
|
1872
|
+
};
|
|
1873
|
+
add: {
|
|
1874
|
+
type: string;
|
|
1875
|
+
description: string;
|
|
1876
|
+
};
|
|
1877
|
+
reason: {
|
|
1878
|
+
type: string;
|
|
1879
|
+
description: string;
|
|
1880
|
+
};
|
|
1881
|
+
};
|
|
1882
|
+
required: string[];
|
|
1883
|
+
additionalProperties: boolean;
|
|
1884
|
+
};
|
|
1885
|
+
};
|
|
1886
|
+
requestId: {
|
|
1887
|
+
type: string;
|
|
1888
|
+
description: string;
|
|
1889
|
+
};
|
|
1890
|
+
};
|
|
1891
|
+
required: string[];
|
|
1892
|
+
additionalProperties: boolean;
|
|
1893
|
+
};
|
|
1660
1894
|
} | {
|
|
1661
1895
|
type: string;
|
|
1662
1896
|
name: string;
|
|
@@ -1878,6 +2112,15 @@ export declare function nativeSessionConfig(runtimeKind: RuntimeKind, mapping: R
|
|
|
1878
2112
|
type: string;
|
|
1879
2113
|
description: string;
|
|
1880
2114
|
} | undefined;
|
|
2115
|
+
options?: {
|
|
2116
|
+
type: string;
|
|
2117
|
+
items: {
|
|
2118
|
+
type: string;
|
|
2119
|
+
maxLength: number;
|
|
2120
|
+
};
|
|
2121
|
+
maxItems: number;
|
|
2122
|
+
description: string;
|
|
2123
|
+
} | undefined;
|
|
1881
2124
|
gate?: {
|
|
1882
2125
|
type: string;
|
|
1883
2126
|
description: string;
|
|
@@ -1890,6 +2133,7 @@ export declare function nativeSessionConfig(runtimeKind: RuntimeKind, mapping: R
|
|
|
1890
2133
|
type: string;
|
|
1891
2134
|
additionalProperties: {
|
|
1892
2135
|
type: string;
|
|
2136
|
+
maxLength: number;
|
|
1893
2137
|
};
|
|
1894
2138
|
description: string;
|
|
1895
2139
|
} | undefined;
|
|
@@ -1917,6 +2161,41 @@ export declare function nativeSessionConfig(runtimeKind: RuntimeKind, mapping: R
|
|
|
1917
2161
|
required: string[];
|
|
1918
2162
|
additionalProperties: boolean;
|
|
1919
2163
|
};
|
|
2164
|
+
} | {
|
|
2165
|
+
type: string;
|
|
2166
|
+
name: string;
|
|
2167
|
+
description: string;
|
|
2168
|
+
inputSchema: {
|
|
2169
|
+
type: string;
|
|
2170
|
+
properties: {
|
|
2171
|
+
action: {
|
|
2172
|
+
type: string;
|
|
2173
|
+
enum: string[];
|
|
2174
|
+
};
|
|
2175
|
+
dueAt: {
|
|
2176
|
+
type: string;
|
|
2177
|
+
description: string;
|
|
2178
|
+
};
|
|
2179
|
+
prompt: {
|
|
2180
|
+
type: string;
|
|
2181
|
+
description: string;
|
|
2182
|
+
};
|
|
2183
|
+
requestId: {
|
|
2184
|
+
type: string;
|
|
2185
|
+
description: string;
|
|
2186
|
+
};
|
|
2187
|
+
id: {
|
|
2188
|
+
type: string;
|
|
2189
|
+
description: string;
|
|
2190
|
+
};
|
|
2191
|
+
status: {
|
|
2192
|
+
type: string;
|
|
2193
|
+
enum: string[];
|
|
2194
|
+
};
|
|
2195
|
+
};
|
|
2196
|
+
required: string[];
|
|
2197
|
+
additionalProperties: boolean;
|
|
2198
|
+
};
|
|
1920
2199
|
} | {
|
|
1921
2200
|
type: string;
|
|
1922
2201
|
name: string;
|
package/dist/session-config.js
CHANGED
|
@@ -5,9 +5,10 @@ import { anyModel, profileModel } from "@anhlp/alp-core/profiles";
|
|
|
5
5
|
import { models, thinkingOptionsFor } from "./catalog.js";
|
|
6
6
|
import { claudeSandboxAvailable, SKILL_PLUGIN } from "./claude-transport.js";
|
|
7
7
|
import { languageInstruction } from "./language.js";
|
|
8
|
-
import {
|
|
8
|
+
import { antigravityModeText } from "./antigravity-transport.js";
|
|
9
|
+
import { HANDOFF_TOOL, WAIT_TOOL, SEND_TOOL, MERGE_TOOL, VERIFY_TOOL, DISCARD_TOOL, RESOLVE_TOOL, CANCEL_TOOL, RECALL_TOOL, PIN_TOOL, BOARD_TOOL, UNPIN_TOOL, ASK_TOOL, LESSON_TOOL, LESSON_CURATE_TOOL, SKILL_TOOL, ISSUE_TOOL, SCHEDULE_TOOL, mainOf, taskActions, taskTool } from "./tools.js";
|
|
9
10
|
import { COMPACT_SHARE } from "./runtime-context.js";
|
|
10
|
-
var nativeMode = (mapping) => mapping.
|
|
11
|
+
var nativeMode = (mapping) => mapping.copy ? "workspace-write" : mapping.mode;
|
|
11
12
|
function claudeFloor(mapping) {
|
|
12
13
|
if (mapping.runtimeKind !== "claude" || !claudeSandboxAvailable()) return void 0;
|
|
13
14
|
if (mapping.copy) return "workspace-write";
|
|
@@ -28,9 +29,8 @@ function permissionNote(mapping) {
|
|
|
28
29
|
// ALPD §46: ALP has no sandbox around an ACP agent; it answers the agent's permission requests.
|
|
29
30
|
...mapping.runtimeKind === "acp" ? [`ALP's tools (alp_*) come from the MCP server named alp. ALP answers your permission requests by your ${mapping.mode} mode: ${mapping.mode === "read-only" ? "reading and searching only" : mapping.mode === "workspace-write" ? `reading, running commands, and changing files inside ${mapping.workdir} only` : "everything"}. Ask permission before every tool use that changes something, even where you would not need to.`] : [],
|
|
30
31
|
...mapping.runtimeKind === "antigravity" ? [
|
|
31
|
-
|
|
32
|
-
"External MCP tools supplied by ALP also come from the MCP server named alp. Discover its tools: aliases beginning mcp__ and their descriptions identify the original server and tool. Use those aliases when calling the tools."
|
|
33
|
-
...mapping.mode === "read-only" ? ["Read-only is emulated by instructions, not enforced by an OS sandbox. Your role is to read, analyze, advise and report only. Do not edit, create, delete or rename files. Do not run commands, builds, tests or native tools that mutate files, repositories, configuration or external state. Report any work that requires changes to your requester. ALP still restricts its own tools according to your read-only role."] : []
|
|
32
|
+
`ALP's tools (alp_*) come from the MCP server named alp. Your mode is ${mapping.mode}: ${antigravityModeText(mapping.mode)}`,
|
|
33
|
+
"External MCP tools supplied by ALP also come from the MCP server named alp. Discover its tools: aliases beginning mcp__ and their descriptions identify the original server and tool. Use those aliases when calling the tools."
|
|
34
34
|
] : [],
|
|
35
35
|
...mapping.copy ? [`You work in a disposable copy of your requester's tree at ${mapping.workdir}: the same files and git state, uncommitted changes included${mapping.copyOf ? `, mirroring ${mapping.copyOf}` : ""}. Write, build and test there; nothing you change reaches the requester, and the copy is removed when you finish. Where your brief names a path${mapping.copyOf ? ` under ${mapping.copyOf}` : ""}, use the same path in your copy. Never run a command in, or write to, the requester's tree.`] : [],
|
|
36
36
|
...floor ? [`Bash runs in an OS sandbox: ${floor === "read-only" ? "it writes nothing but temporary files" : `it writes only ${mapping.workdir} and temporary files`}, and has no network. Run any command you need for your work in it.${profile?.allow.length || profile?.ask.length || profile?.beyondMode === "ask" ? " To run a command outside it (one your profile allows, or one for the user to approve), set dangerouslyDisableSandbox on that Bash call: ALP decides, and asks the user when your profile says so. A sandbox error (Operation not permitted, no network) is not a refusal by the user: run that same command again with dangerouslyDisableSandbox rather than report it refused." : ""}`] : []
|
|
@@ -97,7 +97,7 @@ function nativeSessionConfig(runtimeKind, mapping, targets, parentAgent, role, s
|
|
|
97
97
|
dynamicTools: [SEND_TOOL, BOARD_TOOL, taskTool(taskActions(mapping, parentAgent, role))]
|
|
98
98
|
};
|
|
99
99
|
}
|
|
100
|
-
const delegationInstruction = targets.length ? `Use alp_delegate to assign bounded work to: ${targets.join(", ")}. Delegation has two finite budgets shared by the entire root session tree: 16 implementation starts (lead/peer) and separately 16 read-only advisor starts (reviewer/oracle). Only a new accepted user prompt in root, including steering, resets both; child turns, mail wakes and approval answers do not. Started assignments count even when they fail. Work runs in the background: by default alp_delegate starts the assignment and returns its assignmentId at once, and its result, questions and stall reports come to you as mail. Pass wait: true only when your very next step cannot go on without the result; it then returns the result, or early with the child's first question. A result carries the child's structured handoff (null if it filed none) and output, its final message. While assignments run, go on with work that does not depend on them; when only their results are left, alp_wait for them (mail from your requester or the user ends the wait early), or end your turn and ALP wakes you with their results and questions. Answer questions with alp_send kind answer and replyTo; use kind steer to change an instruction, note for information. To stop an assignment, for example one parked on a usage limit whose work should go on now, use alp_cancel and delegate the rest, on another runtime (pass a model of claude: or codex:); its changes stay in the checkout or its worktree. At most ${mapping.workflow.maxPeers} peers may run concurrently. Concurrent peers must be read-only or isolated: pass isolation "worktree" to give a writing peer its own git worktree. A worktree result lists its branch and changed files; apply it with alp_merge (uncommitted, conflicts left as markers) or drop it with alp_discard, then verify. Writers in this shared checkout run one at a time. To learn why a finished assignment did something, ask it with alp_recall rather than guessing from its handoff. When the project configures verify commands, ALP runs them before alp_merge applies a change, and after a writer in your checkout finishes; a failed check applies nothing. To fix a failed worktree change, delegate again with continueFrom set to its assignmentId. Do not run shell/file mutations in parallel with delegation. Include scope, constraints, verification, and required handoff in task. Child inherits your mode unless you request read-only. Review its returned evidence before answering. Do not use native spawn tools or shell-launched agents to bypass this route.` : "No delegation targets are authorized. Do not spawn agents or use shell-launched agents. Complete your assigned scope and return evidence.";
|
|
100
|
+
const delegationInstruction = targets.length ? `Use alp_delegate to assign bounded work to: ${targets.join(", ")}. Delegation has two finite budgets shared by the entire root session tree: 16 implementation starts (lead/peer) and separately 16 read-only advisor starts (reviewer/oracle). Only a new accepted user prompt in root, including steering, resets both; child turns, mail wakes and approval answers do not. Started assignments count even when they fail. Work runs in the background: by default alp_delegate starts the assignment and returns its assignmentId at once, and its result, questions and stall reports come to you as mail. Pass wait: true only when your very next step cannot go on without the result; it then returns the result, or early with the child's first question. A result carries the child's structured handoff (null if it filed none) and output, its final message. While assignments run, go on with work that does not depend on them; when only their results are left, alp_wait for them (mail from your requester or the user ends the wait early), or end your turn and ALP wakes you with their results and questions. Answer questions with alp_send kind answer and replyTo; use kind steer to change an instruction, note for information. To stop an assignment, for example one parked on a usage limit whose work should go on now, use alp_cancel and delegate the rest, on another runtime (pass a model of claude: or codex:); its changes stay in the checkout or its worktree. At most ${mapping.workflow.maxPeers} peers may run concurrently. Concurrent peers must be read-only or isolated: pass isolation "worktree" to give a writing peer its own git worktree. A worktree result lists its branch and changed files; apply it with alp_merge (uncommitted, conflicts left as markers) or drop it with alp_discard, then verify. Writers in this shared checkout run one at a time. A writer's change outside a worktree stays a result ALP keeps, and its checkout cannot be removed, until you record with alp_resolve that you applied, discarded or acknowledged it. To learn why a finished assignment did something, ask it with alp_recall rather than guessing from its handoff. When the project configures verify commands, ALP runs them before alp_merge applies a change, and after a writer in your checkout finishes; a failed check applies nothing. To fix a failed worktree change, delegate again with continueFrom set to its assignmentId. Do not run shell/file mutations in parallel with delegation. Include scope, constraints, verification, and required handoff in task. Child inherits your mode unless you request read-only. Review its returned evidence before answering. Do not use native spawn tools or shell-launched agents to bypass this route.` : "No delegation targets are authorized. Do not spawn agents or use shell-launched agents. Complete your assigned scope and return evidence.";
|
|
101
101
|
return {
|
|
102
102
|
runtime: runtimeKind,
|
|
103
103
|
cwd: mapping.workdir,
|
|
@@ -117,7 +117,7 @@ function nativeSessionConfig(runtimeKind, mapping, targets, parentAgent, role, s
|
|
|
117
117
|
// The team's house rules (ALPD §42); Phở and Cafe's are the text this line held before teams.
|
|
118
118
|
`Profile: ${mapping.workflow.mode}; fixed for this session.${mapping.houseRules ? ` ${mapping.houseRules}` : ""}`,
|
|
119
119
|
`Oracle runs on ${mapping.oracleModels.join(" or ")}; pass one as model (effort follows the team's oracle settings, otherwise high). For two independent opinions, start one oracle on each model with wait: false and compare their advice. If the model you need is unavailable, say so rather than choosing another. Usage context is advisory, may be unavailable or stale; never infer quota from token counts. Respect known exhausted limits and report them.`,
|
|
120
|
-
...supervised ? ["A supervisor reviews your process after each turn. Its notes ask about process mistakes: answer them in your reply, then record each lesson with alp_lesson (scope project for this project, user for every project). Do not argue a note away; when it is wrong, say why in one line. When three or more lessons cover one theme, or a lesson recurs, distill them into a skill with alp_skill: a method with steps and checks, listing the lessons it replaces. Scope it to the roles whose work it guides: yourself, lead, peer, oracle, reviewer, supervisor, or a custom agent; a lesson about briefing peers is yours, a lesson about verifying a change belongs to whoever makes it. The user approves it first."] : [],
|
|
120
|
+
...supervised ? ["A supervisor reviews your process after each turn. Its notes ask about process mistakes: answer them in your reply, then record each lesson with alp_lesson (scope project for this project, user for every project). Do not argue a note away; when it is wrong, say why in one line. When three or more lessons cover one theme, or a lesson recurs, distill them into a skill with alp_skill: a method with steps and checks, listing the lessons it replaces. Scope it to the roles whose work it guides: yourself, lead, peer, oracle, reviewer, supervisor, or a custom agent; a lesson about briefing peers is yours, a lesson about verifying a change belongs to whoever makes it. The user approves it first. To merge, shorten or remove lessons use alp_lesson_curate (the curate skill), never a file edit."] : [],
|
|
121
121
|
...!parentAgent && mapping.agent.name === mainOf(mapping) ? ["When you find a problem outside the task that is worth tracking (a bug or gap in this project, or in ALP itself: its process, tools, agent instructions or runtime), search with alp_issue action search, then propose a comment on a matching issue or a new issue. Include facts, reproduction and evidence, never secrets. The user approves every post; never post issues or comments any other way, such as with gh in a shell."] : [],
|
|
122
122
|
`ALP runtime identity: ${mapping.agent.name}. ${delegationInstruction}`,
|
|
123
123
|
!parentAgent && mapping.agent.name === mainOf(mapping) ? `Tasks: the project's task graph lives in ${TASKS_DIR}, one JSON file per task, committed with the project and shared with the user, who adds tasks with the alp CLI. Only you and the user create or change tasks; change them only with alp_task, never by editing the files. Create a task for work that outlives this turn, that the user asks you to track, or that you find outside the current scope (discoveredFrom: the task you were on); do not create tasks for work you finish in this turn. Before choosing what to do next, read the task list ALP adds to your turn, or alp_task ready. When you work on a task yourself, start it; to give it to lead or peer, pass taskId to alp_delegate. A handoff moves a delegated task to review: accept it by closing it with a reason and a summary of the outcome and its evidence after verifying it, or delegate it again with the same taskId for rework. Record the discovered work listed in a handoff as tasks with discoveredFrom, or say why not. Model order with blockedBy and grouping with an epic parent.` : `Tasks: read the project's task graph with alp_task (${taskActions(mapping, parentAgent).join(", ")}). Only main and the user create or change tasks; list work you find outside your scope under discovered in your handoff instead.`,
|
|
@@ -178,11 +178,11 @@ function nativeSessionConfig(runtimeKind, mapping, targets, parentAgent, role, s
|
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
180
|
] : [],
|
|
181
|
-
...targets.length ? [WAIT_TOOL, CANCEL_TOOL, MERGE_TOOL, DISCARD_TOOL, VERIFY_TOOL, RECALL_TOOL] : [],
|
|
181
|
+
...targets.length ? [WAIT_TOOL, CANCEL_TOOL, MERGE_TOOL, DISCARD_TOOL, RESOLVE_TOOL, VERIFY_TOOL, RECALL_TOOL] : [],
|
|
182
182
|
...targets.length || parentAgent ? [SEND_TOOL] : [],
|
|
183
183
|
...parentAgent ? [HANDOFF_TOOL] : [],
|
|
184
|
-
...supervised ? [LESSON_TOOL, SKILL_TOOL] : [],
|
|
185
|
-
...!parentAgent && mapping.agent.name === mainOf(mapping) ? [ISSUE_TOOL] : [],
|
|
184
|
+
...supervised ? [LESSON_TOOL, LESSON_CURATE_TOOL, SKILL_TOOL] : [],
|
|
185
|
+
...!parentAgent && mapping.agent.name === mainOf(mapping) ? [ISSUE_TOOL, SCHEDULE_TOOL] : [],
|
|
186
186
|
ASK_TOOL,
|
|
187
187
|
PIN_TOOL,
|
|
188
188
|
BOARD_TOOL,
|
package/dist/session-state.d.ts
CHANGED
|
@@ -1,15 +1,29 @@
|
|
|
1
|
-
import type { RuntimeTransport } from './contracts.js';
|
|
1
|
+
import type { NativeBase, RuntimeTransport } from './contracts.js';
|
|
2
2
|
import type { RuntimeKind, SessionSpec, ResolvedSession } from './resolve.js';
|
|
3
3
|
import type { MailEvent } from './mailbox.js';
|
|
4
4
|
import type { Worktree, WorktreeChange, Copy } from './workspace.js';
|
|
5
5
|
import type { Verification } from '@anhlp/alp-core/verify';
|
|
6
6
|
import type { Handoff } from './handoff.js';
|
|
7
7
|
import type { SessionUsage } from './events.js';
|
|
8
|
+
/** The pause that stopped a turn; a matching resume may arrive before its interruption settles. */
|
|
9
|
+
export type ParkPause = {
|
|
10
|
+
scope: RuntimeKind | 'all';
|
|
11
|
+
resumed?: boolean; /** The pause was alpd's, for a full disk (t-2831). */
|
|
12
|
+
disk?: boolean;
|
|
13
|
+
};
|
|
14
|
+
export type Parked = {
|
|
15
|
+
reason: string;
|
|
16
|
+
since: number;
|
|
17
|
+
prompt?: string;
|
|
18
|
+
pause?: ParkPause;
|
|
19
|
+
};
|
|
8
20
|
export type Session = {
|
|
9
21
|
runtimeKind: RuntimeKind;
|
|
10
22
|
runtime: RuntimeTransport;
|
|
11
23
|
mapping: ResolvedSession;
|
|
12
24
|
threadId: string;
|
|
25
|
+
/** Claude: the conversation threadId is made from on its first prompt, until then (a fork or rewind, §12.7). */
|
|
26
|
+
base?: NativeBase;
|
|
13
27
|
active?: string;
|
|
14
28
|
/** A continued turn accepts a simultaneous user auto prompt as steering. */
|
|
15
29
|
resumedTurn?: string;
|
|
@@ -44,11 +58,7 @@ export type Session = {
|
|
|
44
58
|
/** Set by interrupt: pending mail waits for the next user prompt. */
|
|
45
59
|
wakeBlocked: boolean;
|
|
46
60
|
/** An assignment a usage limit or a pause stopped: it waits, open, until its runtime resumes. prompt is what continues it. */
|
|
47
|
-
parked?:
|
|
48
|
-
reason: string;
|
|
49
|
-
since: number;
|
|
50
|
-
prompt?: string;
|
|
51
|
-
};
|
|
61
|
+
parked?: Parked;
|
|
52
62
|
/** What the requester of a session parked by its turn's end is told happens next, instead of waiting for alp resume. */
|
|
53
63
|
parkThen?: string;
|
|
54
64
|
/** When ALP restarted this session's native process, within the last RESTART_WINDOW_MS. */
|
|
@@ -61,14 +71,42 @@ export type Session = {
|
|
|
61
71
|
usage?: SessionUsage;
|
|
62
72
|
/** The context advisory was given since the context last emptied (ALPD §57). */
|
|
63
73
|
contextLevel?: number;
|
|
74
|
+
/** How full its context last was, 0..1 (t-0e56). */
|
|
75
|
+
contextFill?: number;
|
|
76
|
+
/** The user asked to compact it; done at the next turn boundary (t-0e56). */
|
|
77
|
+
compactRequested?: boolean;
|
|
78
|
+
/** A compaction in progress (t-0e56): main writing its checkpoint, then the runtime compacting. */
|
|
79
|
+
compacting?: {
|
|
80
|
+
phase: 'checkpoint' | 'native' | 'fresh';
|
|
81
|
+
trigger: 'auto' | 'manual';
|
|
82
|
+
checkpoint?: string;
|
|
83
|
+
startedAt: number; /** Its checkpoint turn was started. */
|
|
84
|
+
turn?: boolean; /** The runtime took the native request. */
|
|
85
|
+
requested?: boolean;
|
|
86
|
+
};
|
|
87
|
+
/** Compacted since main's last turn began: usage reported meanwhile may still count the old context. */
|
|
88
|
+
compactCooling?: boolean;
|
|
89
|
+
/** When its last compaction failed: automatic ones wait COMPACT_RETRY_MS after it. */
|
|
90
|
+
compactFailedAt?: number;
|
|
91
|
+
/** The user's prompts held while it compacts, sent after (t-0e56). */
|
|
92
|
+
compactBuffer?: import('./contracts.js').PromptInput[];
|
|
93
|
+
/** The user's last message to it, seeded into a fresh conversation after a compaction (t-0e56). */
|
|
94
|
+
lastUserText?: string;
|
|
64
95
|
/** An assignment's brief as its requester gave it, repeated after a compaction. */
|
|
65
96
|
brief?: string;
|
|
66
97
|
/** The skills it has used, each logged once (ALPD §59). */
|
|
67
98
|
skillsUsed?: Set<string>;
|
|
68
99
|
/** Why the running turn is being stopped, so its end parks the assignment instead of ending it. */
|
|
69
100
|
parkReason?: string;
|
|
101
|
+
parkPause?: ParkPause;
|
|
70
102
|
/** Mail arrived while its runtime was paused; it is delivered on resume. */
|
|
71
103
|
wakeHeld?: boolean;
|
|
104
|
+
/** How many lifecycle operations (a rewind) hold its wakes now; mail waits until the last releases (AlpRuntime.hold). */
|
|
105
|
+
lifecycleHolds?: number;
|
|
106
|
+
/** Its parked work was to continue during a lifecycle hold; it continues when the last hold releases. */
|
|
107
|
+
resumeHeld?: Parked;
|
|
108
|
+
/** An assignment opened but not yet sent its brief: mail waits and rides with the brief's turn. */
|
|
109
|
+
awaitingBrief?: boolean;
|
|
72
110
|
/** Permission questions to the user, one at a time. */
|
|
73
111
|
permissionQueue?: Promise<unknown>;
|
|
74
112
|
toolCalls: Map<string, Promise<unknown>>;
|