@dharma-ai-labs/agent-fabric 0.2.93 → 0.2.95
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/demoEnrollment.d.ts +6 -0
- package/dist/demoEnrollment.d.ts.map +1 -1
- package/dist/demoEnrollment.js +35 -2
- package/dist/demoEnrollment.js.map +1 -1
- package/dist/demoEnrollment.test.js +43 -9
- package/dist/demoEnrollment.test.js.map +1 -1
- package/dist/demoPackage.d.ts +62 -0
- package/dist/demoPackage.d.ts.map +1 -0
- package/dist/demoPackage.js +404 -0
- package/dist/demoPackage.js.map +1 -0
- package/dist/demoPackage.test.d.ts +2 -0
- package/dist/demoPackage.test.d.ts.map +1 -0
- package/dist/demoPackage.test.js +365 -0
- package/dist/demoPackage.test.js.map +1 -0
- package/dist/demoPeer.test.js +14 -2
- package/dist/demoPeer.test.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +99 -14
- package/dist/index.js.map +1 -1
- package/dist/index.test.js +2 -2
- package/dist/repositoryCandidateSync.d.ts +2 -0
- package/dist/repositoryCandidateSync.d.ts.map +1 -1
- package/dist/repositoryCandidateSync.js +12 -2
- package/dist/repositoryCandidateSync.js.map +1 -1
- package/dist/repositoryCandidateSync.test.js +27 -0
- package/dist/repositoryCandidateSync.test.js.map +1 -1
- package/dist/repositoryPackage.d.ts +5 -0
- package/dist/repositoryPackage.d.ts.map +1 -1
- package/dist/repositoryPackage.js +19 -1
- package/dist/repositoryPackage.js.map +1 -1
- package/dist/repositorySourceInventoryClient.d.ts +15 -0
- package/dist/repositorySourceInventoryClient.d.ts.map +1 -0
- package/dist/repositorySourceInventoryClient.js +106 -0
- package/dist/repositorySourceInventoryClient.js.map +1 -0
- package/dist/repositorySourceReconciliation.d.ts +16 -0
- package/dist/repositorySourceReconciliation.d.ts.map +1 -0
- package/dist/repositorySourceReconciliation.js +69 -0
- package/dist/repositorySourceReconciliation.js.map +1 -0
- package/dist/repositorySourceReconciliation.test.d.ts +2 -0
- package/dist/repositorySourceReconciliation.test.d.ts.map +1 -0
- package/dist/repositorySourceReconciliation.test.js +153 -0
- package/dist/repositorySourceReconciliation.test.js.map +1 -0
- package/dist/repositorySourceSync.d.ts +34 -1
- package/dist/repositorySourceSync.d.ts.map +1 -1
- package/dist/repositorySourceSync.js +41 -5
- package/dist/repositorySourceSync.js.map +1 -1
- package/dist/repositorySourceSync.test.js +73 -2
- package/dist/repositorySourceSync.test.js.map +1 -1
- package/dist/usage.d.ts +1 -1
- package/dist/usage.d.ts.map +1 -1
- package/dist/usage.js +1 -1
- package/dist/usage.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -17,9 +17,9 @@ import { contentHash, getActiveSkillBundleAuthorization, getExpiredSkillBundleAu
|
|
|
17
17
|
import { executeTask, FileActionExecutionJournal, FileTaskReceiptStore, providerInstructionsForTask, } from '@dharma-ai-labs/agent-fabric-task-runner';
|
|
18
18
|
import { CLI_USAGE } from './usage.js';
|
|
19
19
|
import { initializeRepositoryKnowledge, readRepositoryKnowledgeSource } from './repositoryKnowledge.js';
|
|
20
|
-
import { inventoryRepositoryPackage, readRepositorySourceBaselineSnapshot, writeRepositoryPackageSnapshot } from './repositoryPackage.js';
|
|
20
|
+
import { inventoryRepositoryPackage, readRepositoryPackageSnapshot, readRepositorySourceBaselineSnapshot, writeRepositoryPackageSnapshot } from './repositoryPackage.js';
|
|
21
21
|
import { validateRepositorySourceAuthorization } from './repositorySourceAuthorization.js';
|
|
22
|
-
import { BlockedRepositorySourceRetry, fetchRepositorySourceAuthorization, RepositorySourceWatcher, scanRepositorySourceChanges, seedRepositorySourceWatcher } from './repositorySourceSync.js';
|
|
22
|
+
import { advanceRepositorySourceBaseline, BlockedRepositorySourceRetry, fetchRepositorySourceAuthorization, RepositorySourceWatcher, scanRepositorySourceChanges, seedRepositorySourceWatcher } from './repositorySourceSync.js';
|
|
23
23
|
import { assertRepositoryInstallerOwnership, writeRepositoryInstallerFile } from './repositoryInstallerFiles.js';
|
|
24
24
|
import { receiveRepositoryPackageDelivery } from './repositoryPackageDelivery.js';
|
|
25
25
|
import { selectInstalledRepositoryKnowledge } from './repositoryInstalledKnowledge.js';
|
|
@@ -35,7 +35,8 @@ import { withOnboardingStage } from './onboardingStage.js';
|
|
|
35
35
|
import { waitForRepositoryReadiness } from './repositoryReadinessWait.js';
|
|
36
36
|
import { connectDemoDevice, verifyDemoDevice } from './demoEnrollment.js';
|
|
37
37
|
import { performDemoPeerAction, withDemoDeviceLock } from './demoPeer.js';
|
|
38
|
-
|
|
38
|
+
import { demoRepositoryPackage } from './demoPackage.js';
|
|
39
|
+
const VERSION = '0.2.95';
|
|
39
40
|
const USAGE = CLI_USAGE;
|
|
40
41
|
const execFileAsync = promisify(execFile);
|
|
41
42
|
const LOCAL_PROVIDER_IDS = ['codex', 'claude', 'agy', 'hermes'];
|
|
@@ -2809,6 +2810,12 @@ async function bindRepositoryAgent(fabric, item) {
|
|
|
2809
2810
|
sourcePolicyGenerationId: canonicalRepositoryPackagePolicyGeneration(response.repositoryPackageSourcePolicyGenerationId),
|
|
2810
2811
|
localBaselineSnapshotHash: item.repositoryBindingId === repositoryAgent?.id
|
|
2811
2812
|
? item.repositoryPackage?.localBaselineSnapshotHash : null,
|
|
2813
|
+
publishedLocalSnapshotHash: item.repositoryBindingId === repositoryAgent?.id
|
|
2814
|
+
? item.repositoryPackage?.publishedLocalSnapshotHash : null,
|
|
2815
|
+
pendingLocalSnapshotHash: item.repositoryBindingId === repositoryAgent?.id
|
|
2816
|
+
? item.repositoryPackage?.pendingLocalSnapshotHash : null,
|
|
2817
|
+
pendingLocalOperationId: item.repositoryBindingId === repositoryAgent?.id
|
|
2818
|
+
? item.repositoryPackage?.pendingLocalOperationId : null,
|
|
2812
2819
|
},
|
|
2813
2820
|
repositoryRole: canonicalEndpointRole(response.endpointRole),
|
|
2814
2821
|
repositoryAgentKey: String(repositoryAgent?.agent_key || ''),
|
|
@@ -3285,6 +3292,15 @@ async function onboard(flags) {
|
|
|
3285
3292
|
: refreshPolicy ? 'repository_update' : canonicalPackage.consolidationMode,
|
|
3286
3293
|
sourcePolicyGenerationId: refreshPolicy ? sourceAuthorization.generationId : canonicalPackage.sourcePolicyGenerationId,
|
|
3287
3294
|
localBaselineSnapshotHash: initialSnapshot.manifest.snapshotHash,
|
|
3295
|
+
publishedLocalSnapshotHash: candidate.state === 'published'
|
|
3296
|
+
&& candidate.snapshotHash === initialSnapshot.manifest.snapshotHash
|
|
3297
|
+
? initialSnapshot.manifest.snapshotHash : canonicalPackage.publishedLocalSnapshotHash ?? null,
|
|
3298
|
+
pendingLocalSnapshotHash: canonicalPackage.state === 'absent' || refreshPolicy
|
|
3299
|
+
? candidate.state === 'accepted' || candidate.state === 'processing'
|
|
3300
|
+
? initialSnapshot.manifest.snapshotHash : null : null,
|
|
3301
|
+
pendingLocalOperationId: canonicalPackage.state === 'absent' || refreshPolicy
|
|
3302
|
+
? candidate.state === 'accepted' || candidate.state === 'processing'
|
|
3303
|
+
? candidate.operationId : null : null,
|
|
3288
3304
|
} };
|
|
3289
3305
|
await saveWorkspaceRecord(registered);
|
|
3290
3306
|
const providers = await staged('role_registration', async () => receiptAwareProviderCapabilities(await Promise.all(selectedProviderAdapters(providerIds).map((adapter) => adapter.capability()))));
|
|
@@ -5186,15 +5202,24 @@ async function relayStart(flags) {
|
|
|
5186
5202
|
const repositorySourceWatcher = new RepositorySourceWatcher();
|
|
5187
5203
|
const blockedRepositorySourceRetry = new BlockedRepositorySourceRetry();
|
|
5188
5204
|
let repositorySourceBaselineAvailable = true;
|
|
5189
|
-
|
|
5205
|
+
let publishedLocalSnapshotHash = canonicalWorkspace.repositoryPackage?.publishedLocalSnapshotHash
|
|
5206
|
+
|| (canonicalWorkspace.repositoryPackage?.state === 'published'
|
|
5207
|
+
&& canonicalWorkspace.repositoryPackage.snapshotHash === canonicalWorkspace.repositoryPackage.localBaselineSnapshotHash
|
|
5208
|
+
? canonicalWorkspace.repositoryPackage.snapshotHash : null);
|
|
5209
|
+
if (publishedLocalSnapshotHash) {
|
|
5190
5210
|
try {
|
|
5191
|
-
await
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5197
|
-
|
|
5211
|
+
await readRepositoryPackageSnapshot(canonicalWorkspace.path, publishedLocalSnapshotHash);
|
|
5212
|
+
const localHash = canonicalWorkspace.repositoryPackage?.localBaselineSnapshotHash;
|
|
5213
|
+
if (localHash && (localHash === publishedLocalSnapshotHash
|
|
5214
|
+
|| canonicalWorkspace.repositoryPackage?.pendingLocalSnapshotHash === localHash)) {
|
|
5215
|
+
await seedRepositorySourceWatcher({ workspace: canonicalWorkspace.path,
|
|
5216
|
+
organizationId: canonicalWorkspace.organizationId, workspaceId: canonicalWorkspace.workspaceId,
|
|
5217
|
+
repositoryBindingId: canonicalWorkspace.repositoryBindingId,
|
|
5218
|
+
repositoryAgentId: canonicalWorkspace.repositoryAgentId,
|
|
5219
|
+
publishedHash: publishedLocalSnapshotHash,
|
|
5220
|
+
localHash,
|
|
5221
|
+
watcher: repositorySourceWatcher });
|
|
5222
|
+
}
|
|
5198
5223
|
}
|
|
5199
5224
|
catch {
|
|
5200
5225
|
repositorySourceBaselineAvailable = false;
|
|
@@ -5299,10 +5324,19 @@ async function relayStart(flags) {
|
|
|
5299
5324
|
repositoryBindingId: canonicalWorkspace.repositoryBindingId,
|
|
5300
5325
|
repositoryAgentId: canonicalWorkspace.repositoryAgentId } });
|
|
5301
5326
|
if (current && canonicalWorkspace.repositoryPackage) {
|
|
5327
|
+
if (current.candidateId !== canonicalWorkspace.repositoryPackage.candidateId
|
|
5328
|
+
|| current.operationId !== canonicalWorkspace.repositoryPackage.operationId) {
|
|
5329
|
+
throw new Error('Repository candidate status changed identity while polling.');
|
|
5330
|
+
}
|
|
5331
|
+
const baseline = advanceRepositorySourceBaseline(canonicalWorkspace.repositoryPackage, current);
|
|
5302
5332
|
canonicalWorkspace = { ...canonicalWorkspace, repositoryPackage: { ...canonicalWorkspace.repositoryPackage,
|
|
5303
5333
|
state: current.state, candidateId: current.candidateId, operationId: current.operationId,
|
|
5304
5334
|
snapshotHash: current.snapshotHash, releaseId: current.releaseId,
|
|
5335
|
+
...baseline,
|
|
5305
5336
|
generation: current.state === 'published' ? Math.max(1, canonicalWorkspace.repositoryPackage.generation) : canonicalWorkspace.repositoryPackage.generation } };
|
|
5337
|
+
publishedLocalSnapshotHash = baseline.publishedLocalSnapshotHash;
|
|
5338
|
+
if (current.state === 'blocked')
|
|
5339
|
+
repositorySourceWatcher.invalidate();
|
|
5306
5340
|
await saveWorkspaceRecord(canonicalWorkspace);
|
|
5307
5341
|
}
|
|
5308
5342
|
}
|
|
@@ -5391,19 +5425,54 @@ async function relayStart(flags) {
|
|
|
5391
5425
|
workspaceId: canonicalWorkspace.workspaceId, repositoryBindingId: canonicalWorkspace.repositoryBindingId,
|
|
5392
5426
|
repositoryAgentId: canonicalWorkspace.repositoryAgentId, transport: fabric, watcher: repositorySourceWatcher,
|
|
5393
5427
|
loadRetainedKnowledge: () => installedRepositoryKnowledge(canonicalWorkspace),
|
|
5394
|
-
|
|
5428
|
+
loadPublishedLocalBaseline: () => publishedLocalSnapshotHash
|
|
5429
|
+
? readRepositoryPackageSnapshot(canonicalWorkspace.path, publishedLocalSnapshotHash) : Promise.resolve(null),
|
|
5430
|
+
submitCandidate: (snapshot, expectedLatestSourceFingerprint) => synchronizeRepositoryCandidate({ transport: fabric,
|
|
5395
5431
|
outboxRoot: resolve(dharmaHome(), 'relay', 'repository-candidates'),
|
|
5396
5432
|
scope: { organizationId: canonicalWorkspace.organizationId,
|
|
5397
5433
|
workspaceId: canonicalWorkspace.workspaceId,
|
|
5398
5434
|
repositoryBindingId: canonicalWorkspace.repositoryBindingId,
|
|
5399
5435
|
repositoryAgentId: canonicalWorkspace.repositoryAgentId },
|
|
5400
|
-
snapshot, initialRepository: false }),
|
|
5436
|
+
snapshot, initialRepository: false, expectedLatestSourceFingerprint }),
|
|
5401
5437
|
});
|
|
5402
5438
|
repositorySourceState = sourceCycle.state;
|
|
5403
5439
|
if (sourceCycle.localMutation) {
|
|
5404
5440
|
repositorySourceCandidates += 1;
|
|
5405
5441
|
if (canonicalWorkspace.repositoryPackage && sourceCycle.persisted) {
|
|
5406
5442
|
canonicalWorkspace.repositoryPackage.localBaselineSnapshotHash = sourceCycle.persisted.snapshotHash;
|
|
5443
|
+
if (sourceCycle.state === 'source_already_published') {
|
|
5444
|
+
canonicalWorkspace.repositoryPackage.publishedLocalSnapshotHash = sourceCycle.persisted.snapshotHash;
|
|
5445
|
+
canonicalWorkspace.repositoryPackage.pendingLocalSnapshotHash = null;
|
|
5446
|
+
canonicalWorkspace.repositoryPackage.pendingLocalOperationId = null;
|
|
5447
|
+
publishedLocalSnapshotHash = sourceCycle.persisted.snapshotHash;
|
|
5448
|
+
}
|
|
5449
|
+
else if (sourceCycle.candidate) {
|
|
5450
|
+
const receipt = sourceCycle.candidate;
|
|
5451
|
+
if (typeof receipt.candidateId === 'string' && typeof receipt.operationId === 'string'
|
|
5452
|
+
&& typeof receipt.snapshotHash === 'string' && sourceCycle.submittedManifestHash) {
|
|
5453
|
+
Object.assign(canonicalWorkspace.repositoryPackage, {
|
|
5454
|
+
state: receipt.state, candidateId: receipt.candidateId, operationId: receipt.operationId,
|
|
5455
|
+
snapshotHash: receipt.snapshotHash, sourceManifestHash: sourceCycle.submittedManifestHash,
|
|
5456
|
+
releaseId: typeof receipt.releaseId === 'string' ? receipt.releaseId : null,
|
|
5457
|
+
consolidationMode: 'repository_update',
|
|
5458
|
+
});
|
|
5459
|
+
}
|
|
5460
|
+
if (receipt.state === 'published') {
|
|
5461
|
+
canonicalWorkspace.repositoryPackage.publishedLocalSnapshotHash = sourceCycle.persisted.snapshotHash;
|
|
5462
|
+
canonicalWorkspace.repositoryPackage.pendingLocalSnapshotHash = null;
|
|
5463
|
+
canonicalWorkspace.repositoryPackage.pendingLocalOperationId = null;
|
|
5464
|
+
publishedLocalSnapshotHash = sourceCycle.persisted.snapshotHash;
|
|
5465
|
+
}
|
|
5466
|
+
else if ((receipt.state === 'accepted' || receipt.state === 'processing')
|
|
5467
|
+
&& typeof receipt.operationId === 'string') {
|
|
5468
|
+
canonicalWorkspace.repositoryPackage.pendingLocalSnapshotHash = sourceCycle.persisted.snapshotHash;
|
|
5469
|
+
canonicalWorkspace.repositoryPackage.pendingLocalOperationId = receipt.operationId;
|
|
5470
|
+
}
|
|
5471
|
+
else if (receipt.state === 'blocked') {
|
|
5472
|
+
canonicalWorkspace.repositoryPackage.localBaselineSnapshotHash = publishedLocalSnapshotHash;
|
|
5473
|
+
repositorySourceWatcher.invalidate();
|
|
5474
|
+
}
|
|
5475
|
+
}
|
|
5407
5476
|
await saveWorkspaceRecord(canonicalWorkspace);
|
|
5408
5477
|
}
|
|
5409
5478
|
}
|
|
@@ -5447,7 +5516,8 @@ export async function run(argv) {
|
|
|
5447
5516
|
return USAGE;
|
|
5448
5517
|
if (flags.has('version') || command === 'version')
|
|
5449
5518
|
return { version: VERSION };
|
|
5450
|
-
if (command === 'demo' && ['connect', 'status', 'role', 'peers', 'ask', 'reply', 'inbox', 'ack', 'resume'
|
|
5519
|
+
if (command === 'demo' && ['connect', 'status', 'role', 'peers', 'ask', 'reply', 'inbox', 'ack', 'resume',
|
|
5520
|
+
'package', 'package-status']
|
|
5451
5521
|
.includes(String(subcommand))) {
|
|
5452
5522
|
const hqUrl = normalizeHqUrl(portalUrl(flags));
|
|
5453
5523
|
const organizationId = required(flags, 'organization-id');
|
|
@@ -5486,6 +5556,21 @@ export async function run(argv) {
|
|
|
5486
5556
|
const { configPath: _configPath, ...receipt } = connected;
|
|
5487
5557
|
return receipt;
|
|
5488
5558
|
}
|
|
5559
|
+
if (subcommand === 'package' || subcommand === 'package-status') {
|
|
5560
|
+
const requestedProvider = String(flags.get('provider') || 'auto').trim().toLowerCase();
|
|
5561
|
+
const provider = subcommand === 'package-status' && requestedProvider === 'auto' ? 'codex'
|
|
5562
|
+
: requestedProvider === 'auto'
|
|
5563
|
+
? await detectBootstrapProvider(workspace) : requestedProvider;
|
|
5564
|
+
if (!isLocalProviderId(provider)) {
|
|
5565
|
+
throw new Error('Demo package provider must be auto, codex, claude, agy, or hermes.');
|
|
5566
|
+
}
|
|
5567
|
+
const demoNativeSkillDirectory = provider === 'codex' ? resolve(workspace, '.agents', 'skills')
|
|
5568
|
+
: provider === 'claude' ? resolve(workspace, '.claude', 'skills')
|
|
5569
|
+
: nativeSkillDirectory(provider);
|
|
5570
|
+
return demoRepositoryPackage({ scope, workspace,
|
|
5571
|
+
statusOnly: subcommand === 'package-status', provider,
|
|
5572
|
+
nativeSkillDirectory: demoNativeSkillDirectory });
|
|
5573
|
+
}
|
|
5489
5574
|
let action = null;
|
|
5490
5575
|
if (subcommand === 'role') {
|
|
5491
5576
|
const categories = repeated.get('category') || [];
|