@xenosystem/agent-interface-host 0.1.134 → 0.1.136

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/index.js CHANGED
@@ -1566,6 +1566,9 @@ export class AgentHostCoordinator {
1566
1566
  if (method.startsWith('workflows.')) {
1567
1567
  return await this.requestWorkflows(method, input);
1568
1568
  }
1569
+ if (method.startsWith('artifacts.')) {
1570
+ return await this.requestArtifacts(method, input);
1571
+ }
1569
1572
  if (method.startsWith('coordination.peers.')) {
1570
1573
  return this.requestPeers(method, input);
1571
1574
  }
@@ -4712,6 +4715,52 @@ export class AgentHostCoordinator {
4712
4715
  }
4713
4716
  return result;
4714
4717
  }
4718
+ /**
4719
+ * Artifacts (ADE §9 step 5, slice 5). `cwd` is a CLAIM, kept only when it is a directory inside a granted root, as
4720
+ * `workflows.*` treats it: a page is never published into, or read from, a folder nobody granted.
4721
+ */
4722
+ async requestArtifacts(method, input) {
4723
+ const operation = method === 'artifacts.list' ? 'list'
4724
+ : method === 'artifacts.get' ? 'get'
4725
+ : method === 'artifacts.read' ? 'read'
4726
+ : method === 'artifacts.publish' ? 'publish'
4727
+ : method === 'artifacts.promote' ? 'promote'
4728
+ : method === 'artifacts.share' ? 'share'
4729
+ : method === 'artifacts.comment' ? 'comment'
4730
+ : method === 'artifacts.reply' ? 'reply'
4731
+ : method === 'artifacts.comments' ? 'comments'
4732
+ : undefined;
4733
+ if (!operation)
4734
+ return { success: false, error: `Unknown artifacts operation: ${method}` };
4735
+ const service = this.options.artifactsService;
4736
+ if (!service)
4737
+ return { success: false, code: 'UNAVAILABLE', error: 'Artifacts are unavailable on this host.' };
4738
+ const cwd = typeof input.cwd === 'string'
4739
+ ? this.workspaceService?.authorizeGrantedDirectory?.(input.cwd, input.caller?.conversationId)
4740
+ : undefined;
4741
+ if (!cwd)
4742
+ return { success: false, code: 'FOLDER_NOT_GRANTED', error: 'That folder has not been granted to this host.' };
4743
+ const text = (value) => typeof value === 'string' ? value : undefined;
4744
+ const files = input.files && typeof input.files === 'object'
4745
+ ? Object.fromEntries(Object.entries(input.files).filter((entry) => typeof entry[1] === 'string'))
4746
+ : undefined;
4747
+ return await service.handle(operation, {
4748
+ cwd,
4749
+ ...(text(input.artifactId) ? { artifactId: input.artifactId } : {}),
4750
+ ...(typeof input.revision === 'number' ? { revision: input.revision } : {}),
4751
+ ...(text(input.filePath) ? { filePath: input.filePath } : {}),
4752
+ ...(text(input.html) ? { html: input.html } : {}),
4753
+ ...(files ? { files } : {}),
4754
+ ...(text(input.title) ? { title: input.title } : {}),
4755
+ ...(text(input.description) ? { description: input.description } : {}),
4756
+ ...(text(input.icon) ? { icon: input.icon } : {}),
4757
+ ...(input.home === 'local' || input.home === 'cloud' ? { home: input.home } : {}),
4758
+ ...(input.visibility === 'link' || input.visibility === 'private' || input.visibility === 'workspace' ? { visibility: input.visibility } : {}),
4759
+ ...(text(input.workspaceId) ? { workspaceId: input.workspaceId } : {}),
4760
+ ...(text(input.body) ? { body: input.body } : {}),
4761
+ ...(text(input.commentId) ? { commentId: input.commentId } : {}),
4762
+ });
4763
+ }
4715
4764
  async requestWorkflows(method, input) {
4716
4765
  const operation = method === 'workflows.definitions' ? 'definitions'
4717
4766
  : method === 'workflows.validate' ? 'validate'