@myclaw163/clawclaw-cli 0.8.23 → 0.8.25
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/docs/custom-modules/api-reference.md +9 -4
- package/docs/custom-modules/behavior.md +3 -2
- package/docs/custom-modules/perception.md +3 -3
- package/package.json +1 -1
- package/skills/clawclaw/SKILL.md +13 -12
- package/skills/clawclaw/references/CLAUDE-CODE-MONITOR.md +3 -1
- package/skills/clawclaw/references/CUSTOM-BEHAVIOR-DEVELOPMENT.md +22 -2
- package/skills/clawclaw/references/CUSTOM-MODULE-API.md +9 -4
- package/skills/clawclaw/references/CUSTOM-PERCEPTION-DEVELOPMENT.md +3 -3
- package/skills/clawclaw/references/STREAM.md +1 -1
- package/src/commands/behavior.ts +1 -0
- package/src/commands/load.ts +6 -5
- package/src/lib/agent-workspace-client.ts +3 -0
- package/src/lib/agent-workspace-runtime.ts +5 -3
- package/src/lib/agent-workspace-skills.ts +3 -2
- package/src/lib/agent-workspace-sync.ts +7 -1
- package/src/lib/capability-cloud-refresh.ts +3 -0
- package/src/lib/capability-cloud-sync.ts +3 -0
- package/src/lib/capability-discovery.ts +2 -2
- package/src/lib/capability-operation-name.ts +2 -0
- package/src/lib/capability-workspace.ts +22 -2
- package/src/runtime/clawclaw/plugins/behavior/behavior-analysis-thread-host.ts +8 -0
- package/src/runtime/clawclaw/plugins/behavior/behavior-catalog.ts +3 -0
- package/src/runtime/clawclaw/plugins/behavior/behavior-instance-snapshot.ts +123 -0
- package/src/runtime/clawclaw/plugins/behavior/behavior-manifest.ts +10 -2
- package/src/runtime/clawclaw/plugins/behavior/behavior-module-loader.ts +3 -0
- package/src/runtime/clawclaw/plugins/behavior/behavior-normalization.ts +2 -0
- package/src/runtime/clawclaw/plugins/behavior/behavior-plugin.ts +10 -1
- package/src/runtime/clawclaw/plugins/behavior/behavior-runner.ts +11 -0
- package/src/runtime/clawclaw/plugins/behavior/behavior-source.ts +11 -1
- package/src/runtime/clawclaw/plugins/behavior/thread-behavior-executor.ts +23 -3
- package/src/runtime/clawclaw/plugins/perception/perception-analysis-thread-pool.ts +11 -2
- package/src/runtime/clawclaw/plugins/perception/perception-plugin.ts +12 -4
- package/src/runtime/clawclaw/plugins/perception/perception-source.ts +2 -1
- package/src/runtime/clawclaw/plugins/trigger/trigger-plugin.ts +4 -1
- package/src/runtime/framework/plugins/contracts.ts +2 -0
- package/src/runtime/framework/plugins/runtime-plugin-scheduler.ts +19 -0
- package/src/sdk/behavior-plugin/index.ts +5 -1
- package/src/sdk/perception-plugin/index.ts +2 -1
- package/src/sdk/resource-metadata.ts +5 -2
|
@@ -495,6 +495,7 @@ export class RuntimePluginScheduler<
|
|
|
495
495
|
private readonly inputEventCommits = new Map<number, Promise<void>>();
|
|
496
496
|
private inputEventCommitTail: Promise<void> = Promise.resolve();
|
|
497
497
|
private readonly catchUpCounts = new Map<string, number>();
|
|
498
|
+
private readonly drainingBatches = new Set<string>();
|
|
498
499
|
private readonly pluginTimingWindows = new Map<string, PluginTimingWindow>();
|
|
499
500
|
private readonly lagBands = new Map<string, RuntimeLagBand>();
|
|
500
501
|
private readonly pausedPlugins = new Set<string>();
|
|
@@ -641,6 +642,7 @@ export class RuntimePluginScheduler<
|
|
|
641
642
|
this.activeScope = cloneCanonical(scope);
|
|
642
643
|
this.pausedPlugins.clear();
|
|
643
644
|
this.catchUpCounts.clear();
|
|
645
|
+
this.drainingBatches.clear();
|
|
644
646
|
for (const layer of this.layers) {
|
|
645
647
|
await Promise.all(layer.map(async (plugin) => {
|
|
646
648
|
const startController = new AbortController();
|
|
@@ -823,6 +825,8 @@ export class RuntimePluginScheduler<
|
|
|
823
825
|
if (candidates.length === 0) continue;
|
|
824
826
|
}
|
|
825
827
|
if (maxInFlight === 1 && this.scheduledInvocationCount(plugin.id) > 0) continue;
|
|
828
|
+
if (this.drainingBatches.has(plugin.id)
|
|
829
|
+
&& (this.scheduledInvocationCount(plugin.id) > 0 || this.activeCommits.has(plugin.id))) continue;
|
|
826
830
|
|
|
827
831
|
if (maxInFlight > 1) {
|
|
828
832
|
const reorderCapacity = (plugin.catchUp ?? 'every_epoch') === 'strict_ordered'
|
|
@@ -976,6 +980,7 @@ export class RuntimePluginScheduler<
|
|
|
976
980
|
const supersededBeforeCommit = !invocation.error
|
|
977
981
|
&& !forbidsCoalescing(buffered.work)
|
|
978
982
|
&& (plugin.catchUp ?? 'every_epoch') === 'latest_only'
|
|
983
|
+
&& plugin.backlogPolicy !== 'finish_started'
|
|
979
984
|
&& latestReadyBeforeCommit > buffered.work.epoch.epochSeq
|
|
980
985
|
? latestReadyBeforeCommit
|
|
981
986
|
: null;
|
|
@@ -1463,6 +1468,20 @@ export class RuntimePluginScheduler<
|
|
|
1463
1468
|
),
|
|
1464
1469
|
10_000,
|
|
1465
1470
|
);
|
|
1471
|
+
if (plugin.backlogPolicy === 'finish_started') {
|
|
1472
|
+
const ready = this.readyCandidates(plugin, scope);
|
|
1473
|
+
if (ready.length > catchUpWindow) this.drainingBatches.add(plugin.id);
|
|
1474
|
+
if (!this.drainingBatches.has(plugin.id)) return;
|
|
1475
|
+
// Do not replace active/buffered work. Stop refilling the current batch
|
|
1476
|
+
// until its ordered effects have completed, then skip only unstarted work.
|
|
1477
|
+
if (this.scheduledInvocationCount(plugin.id) > 0 || this.activeCommits.has(plugin.id)) return;
|
|
1478
|
+
const boundary = ready.findIndex(({ work }) => forbidsCoalescing(work));
|
|
1479
|
+
const target = boundary >= 0 ? boundary : ready.length - 1;
|
|
1480
|
+
if (target > 0) this.recordCoalesced(plugin, ready.slice(0, target).map(x => x.work),
|
|
1481
|
+
boundary >= 0 ? 'required_epoch_boundary' : 'catch_up_limit');
|
|
1482
|
+
this.drainingBatches.delete(plugin.id);
|
|
1483
|
+
return;
|
|
1484
|
+
}
|
|
1466
1485
|
while (true) {
|
|
1467
1486
|
const ready = this.readyCandidates(plugin, scope);
|
|
1468
1487
|
const earliest = ready[0];
|
|
@@ -38,6 +38,8 @@ export type {
|
|
|
38
38
|
|
|
39
39
|
/** How Runtime schedules pure decision computation. Effect commit is ordered in both modes. */
|
|
40
40
|
export type BehaviorExecution = 'parallel' | 'serial';
|
|
41
|
+
/** Opt-in inheritance of the highest successfully completed epoch's instance data. */
|
|
42
|
+
export type BehaviorStateMode = 'isolated' | 'snapshot';
|
|
41
43
|
|
|
42
44
|
interface BehaviorInputFieldBase {
|
|
43
45
|
/** Stable key used in BehaviorInput.input. */
|
|
@@ -250,9 +252,11 @@ export interface BehaviorRuntimeDefaults {
|
|
|
250
252
|
|
|
251
253
|
/** One statically readable author contract for long, short, and reflex Behaviors. */
|
|
252
254
|
export interface ClawclawBehaviorManifest {
|
|
255
|
+
readonly stateMode?: BehaviorStateMode;
|
|
253
256
|
readonly apiVersion: typeof BEHAVIOR_PLUGIN_API_VERSION;
|
|
254
257
|
readonly id: string;
|
|
255
|
-
|
|
258
|
+
/** Legacy modules may provide a name; human-facing text is managed by the host. */
|
|
259
|
+
readonly name?: string;
|
|
256
260
|
readonly description: string;
|
|
257
261
|
readonly localizations?: ClawclawResourceLocalizations;
|
|
258
262
|
readonly inputs: readonly BehaviorInputFieldSpec[];
|
|
@@ -122,7 +122,8 @@ export interface ClawclawPerceptionManifest {
|
|
|
122
122
|
readonly wakeAgent?: boolean;
|
|
123
123
|
readonly apiVersion: typeof PERCEPTION_PLUGIN_API_VERSION;
|
|
124
124
|
readonly id: string;
|
|
125
|
-
|
|
125
|
+
/** Legacy modules may provide a name; human-facing text is managed by the host. */
|
|
126
|
+
readonly name?: string;
|
|
126
127
|
readonly description: string;
|
|
127
128
|
readonly localizations?: ClawclawResourceLocalizations;
|
|
128
129
|
/** Describes Event subjects; every module still receives self as a spatial reference. */
|
|
@@ -9,8 +9,10 @@ export type ClawclawResourceLocalizations = Readonly<
|
|
|
9
9
|
|
|
10
10
|
export interface ClawclawResourceMetadata {
|
|
11
11
|
readonly id: string;
|
|
12
|
-
readonly name
|
|
12
|
+
readonly name?: string;
|
|
13
13
|
readonly description: string;
|
|
14
|
+
/** Host-owned human-facing text; never replaces the script's Agent description. */
|
|
15
|
+
readonly display?: ClawclawLocalizedResourceText;
|
|
14
16
|
readonly localizations?: ClawclawResourceLocalizations;
|
|
15
17
|
}
|
|
16
18
|
|
|
@@ -46,6 +48,7 @@ export function resolveClawclawResourceMetadata(
|
|
|
46
48
|
metadata: ClawclawResourceMetadata,
|
|
47
49
|
locale: string,
|
|
48
50
|
): ClawclawResolvedResourceMetadata {
|
|
51
|
+
if (metadata.display) return { id: metadata.id, ...metadata.display };
|
|
49
52
|
const requested = normalizedLocale(locale);
|
|
50
53
|
const entries = Object.entries(metadata.localizations ?? {});
|
|
51
54
|
const exact = entries.find(([key]) => normalizedLocale(key) === requested)?.[1];
|
|
@@ -57,7 +60,7 @@ export function resolveClawclawResourceMetadata(
|
|
|
57
60
|
const localized = exact ?? languageMatch ?? regionalMatch;
|
|
58
61
|
return {
|
|
59
62
|
id: metadata.id,
|
|
60
|
-
name: localized?.name ?? metadata.name,
|
|
63
|
+
name: localized?.name ?? metadata.name ?? metadata.id,
|
|
61
64
|
description: localized?.description ?? metadata.description,
|
|
62
65
|
};
|
|
63
66
|
}
|