@vess-id/vess 0.0.0-dev-20261009105240 → 0.0.0-dev-20261015045045

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.
@@ -34,6 +34,15 @@ export declare class McpAdapter implements MCPToolHandler {
34
34
  data?: any;
35
35
  error?: string;
36
36
  }>;
37
+ /**
38
+ * `aidentity_get_result`: read the outcome of a `pending` / `in_flight` call. Read-only — only the
39
+ * request id reaches the engine (there is no action or parameters to execute).
40
+ */
41
+ getResult(requestId: string): Promise<{
42
+ success: boolean;
43
+ data?: any;
44
+ error?: string;
45
+ }>;
37
46
  listAvailableTools(): Promise<{
38
47
  success: boolean;
39
48
  data?: any;
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-adapter.d.ts","sourceRoot":"","sources":["../../../src/adapter/mcp/mcp-adapter.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAC7D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACrD,OAAO,EAAkB,2BAA2B,EAAE,MAAM,kBAAkB,CAAA;AAE9E,qBAAa,UAAW,YAAW,cAAc;IACnC,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,eAAe;IAE9C,QAAQ,CAAC,IAAI,EAAE;QACnB,IAAI,EAAE,MAAM,CAAA;QACZ,MAAM,EAAE,MAAM,CAAA;QACd,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;QAChC,QAAQ,CAAC,EAAE;YACT,KAAK,EAAE,MAAM,CAAA;YACb,MAAM,EAAE,MAAM,CAAA;YACd,YAAY,CAAC,EAAE,MAAM,CAAA;YAIrB,UAAU,CAAC,EAAE,MAAM,CAAA;YACnB,UAAU,CAAC,EAAE,MAAM,CAAA;YAInB,UAAU,CAAC,EAAE,MAAM,CAAA;YACnB,UAAU,CAAC,EAAE,MAAM,CAAA;SACpB,CAAA;QAC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AM,CAAA;YACb,MAAM,EAAE,MAAM,CAAA;YACd,YAAY,CAAC,EAAE,MAAM,CAAA;YAIrB,UAAU,CAAC,EAAE,MAAM,CAAA;YACnB,UAAU,CAAC,EAAE,MAAM,CAAA;YAInB,UAAU,CAAC,EAAE,MAAM,CAAA;YACnB,UAAU,CAAC,EAAE,MAAM,CAAA;SACpB,CAAA;QACD,gBAAgB,CAAC,EAAE,MAAM,CAAA;KAC1B,GAAG,OAAO,CAAC;QACV,OAAO,EAAE,OAAO,CAAA;QAChB,IAAI,CAAC,EAAE,GAAG,CAAA;QACV,KAAK,CAAC,EAAE,MAAM,CAAA;QACd,gBAAgB,CAAC,EAAE,GAAG,CAAA;QACtB,kBAAkB,CAAC,EAAE,GAAG,CAAA;QAIxB,cAAc,CAAC,EAAE,2BAA2B,CAAA;KAC7C,CAAC;IA+BI,mBAAmB,CAAC,IAAI,EAAE;QAC9B,IAAI,EAAE,MAAM,CAAA;QACZ,OAAO,EAAE,MAAM,EAAE,CAAA;KAClB,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,IAAI,CAAC,EAAE,GAAG,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAW7D;;;OAGG;IACG,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,IAAI,CAAC,EAAE,GAAG,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAiBvF,kBAAkB,IAAI,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,IAAI,CAAC,EAAE,GAAG,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CAGtF"}
@@ -27,36 +27,58 @@ class McpAdapter {
27
27
  if (!args.tool || !args.action) {
28
28
  return {
29
29
  success: false,
30
- error: 'Both "tool" and "action" are required. When retrying after approval, include the original tool and action along with pendingRequestId.',
30
+ error: 'Both "tool" and "action" are required. To read the outcome of a "pending" call, use aidentity_get_result with its request_id.',
31
31
  };
32
32
  }
33
33
  const action = (0, ai_identity_1.normalizeMcpActionName)(args.tool, args.action);
34
34
  return this.engine.execute({
35
35
  action,
36
36
  input: args.parameters || {},
37
- approval: args.approval ? {
38
- token: args.approval.token,
39
- choice: args.approval.choice,
40
- vcTTLMinutes: args.approval.vcTTLMinutes,
41
- // Thread the Cedar retry-path context through so the engine can
42
- // consume the single-use ledger token (Step 3.5). All optional — the
43
- // engine only takes the retry path when request_id + outcome_id +
44
- // granted_at + granted_by are all present.
45
- request_id: args.approval.request_id,
46
- outcome_id: args.approval.outcome_id,
47
- granted_at: args.approval.granted_at,
48
- granted_by: args.approval.granted_by,
49
- } : undefined,
37
+ approval: args.approval
38
+ ? {
39
+ token: args.approval.token,
40
+ choice: args.approval.choice,
41
+ vcTTLMinutes: args.approval.vcTTLMinutes,
42
+ // Thread the Cedar retry-path context through so the engine can
43
+ // consume the single-use ledger token (Step 3.5). All optional — the
44
+ // engine only takes the retry path when request_id + outcome_id +
45
+ // granted_at + granted_by are all present.
46
+ request_id: args.approval.request_id,
47
+ outcome_id: args.approval.outcome_id,
48
+ granted_at: args.approval.granted_at,
49
+ granted_by: args.approval.granted_by,
50
+ }
51
+ : undefined,
50
52
  pendingRequestId: args.pendingRequestId,
51
53
  });
52
54
  }
53
55
  async issueToolPermission(args) {
54
56
  if (!args.tool || !Array.isArray(args.actions) || args.actions.length === 0) {
55
- return { success: false, error: '"tool" and at least one "action" are required for issueToolPermission.' };
57
+ return {
58
+ success: false,
59
+ error: '"tool" and at least one "action" are required for issueToolPermission.',
60
+ };
56
61
  }
57
62
  const actions = args.actions.map(a => (0, ai_identity_1.normalizeMcpActionName)(args.tool, a));
58
63
  return this.engine.requestPermissions(actions);
59
64
  }
65
+ /**
66
+ * `aidentity_get_result`: read the outcome of a `pending` / `in_flight` call. Read-only — only the
67
+ * request id reaches the engine (there is no action or parameters to execute).
68
+ */
69
+ async getResult(requestId) {
70
+ // `.` / `..` would survive encodeURIComponent and change the GET path.
71
+ if (typeof requestId !== 'string' ||
72
+ requestId === '' ||
73
+ requestId === '.' ||
74
+ requestId === '..') {
75
+ return {
76
+ success: false,
77
+ error: '"request_id" is required (from a "pending" or "in_flight" aidentity_call_tool answer).',
78
+ };
79
+ }
80
+ return this.engine.getResult(requestId);
81
+ }
60
82
  async listAvailableTools() {
61
83
  return this.engine.listAvailableTools();
62
84
  }
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-adapter.js","sourceRoot":"","sources":["../../../src/adapter/mcp/mcp-adapter.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;GAeG;AACH,sDAA6D;AAK7D,MAAa,UAAU;IACQ;IAA7B,YAA6B,MAAuB;QAAvB,WAAM,GAAN,MAAM,CAAiB;IAAG,CAAC;IAExD,KAAK,CAAC,QAAQ,CAAC,IAoBd;QAWC,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YAC/B,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,wIAAwI;aAChJ,CAAA;QACH,CAAC;QACD,MAAM,MAAM,GAAG,IAAA,oCAAsB,EAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;QAC7D,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;YACzB,MAAM;YACN,KAAK,EAAE,IAAI,CAAC,UAAU,IAAI,EAAE;YAC5B,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;gBACxB,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,KAAK;gBAC1B,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAwB;gBAC9C,YAAY,EAAE,IAAI,CAAC,QAAQ,CAAC,YAAY;gBACxC,gEAAgE;gBAChE,qEAAqE;gBACrE,kEAAkE;gBAClE,2CAA2C;gBAC3C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AC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAA,oCAAsB,EAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAA;QAC3E,OAAO,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAA;IAChD,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,SAAS,CAAC,SAAiB;QAC/B,uEAAuE;QACvE,IACE,OAAO,SAAS,KAAK,QAAQ;YAC7B,SAAS,KAAK,EAAE;YAChB,SAAS,KAAK,GAAG;YACjB,SAAS,KAAK,IAAI,EAClB,CAAC;YACD,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,KAAK,EACH,wFAAwF;aAC3F,CAAA;QACH,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,CAAA;IACzC,CAAC;IAED,KAAK,CAAC,kBAAkB;QACtB,OAAO,IAAI,CAAC,MAAM,CAAC,kBAAkB,EAAE,CAAA;IACzC,CAAC;CACF;AAtGD,gCAsGC"}
@@ -1,7 +1,9 @@
1
1
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
2
  import type { ReauthRequiredExecutionInfo } from '../../core/types';
3
- export declare const CALL_TOOL_DESCRIPTION = "Execute an action on an external service or local resource on behalf of the user.\nThis is the PRIMARY tool \u2014 always use this to perform actions. Permission is handled automatically:\n- Read-type actions (low risk) are auto-approved and execute immediately.\n- Write-type actions that need approval will return an approval_required response. Re-call with the approval parameter to confirm or deny.\nDo NOT call aidentity_request_permission first; just call this tool directly.\n\nSupported tools and common actions:\n\n**os** \u2014 Read/write local secret files (.env, credentials, etc.)\n Actions: os.secret.read, os.secret.write\n Example: tool=\"os\", action=\"os.secret.read\", parameters={\"file_path\": \"~/projects/app/.env\"}\n\n**slack** \u2014 Post/read/update/delete messages, list channels, get user info.\n Common actions: slack.message.post, slack.message.read, slack.channel.read, slack.batch.read\n The \"channel\" parameter accepts channel ID (e.g. \"C0A159PP6QM\"), channel name (e.g. \"general\"), or #-prefixed name (e.g. \"#general\"). Responses are compact by default (essential fields only). Set compact=false for full Slack API response.\n Example: tool=\"slack\", action=\"slack.message.post\", parameters={\"channel\": \"C01ABCD2EFG\", \"text\": \"Hello!\"}\n Example: tool=\"slack\", action=\"slack.message.read\", parameters={\"channel\": \"C01ABCD2EFG\", \"limit\": 10}\n\n**github** \u2014 Create/read/update/list issues, pull requests, repositories, contents, labels, Actions workflows, stars, users, notifications and gists.\n Common actions: github.issue.create, github.issue.list, github.issue.read, github.issue.search, github.issue.comment.create, github.pr.create, github.pr.list, github.pr.read, github.pr.merge, github.repo.search, github.content.get, github.content.createOrUpdate, github.branch.list, github.branch.create, github.commit.list, github.code.search, github.repo.create, github.repo.fork, github.label.list, github.label.write, github.workflow.list, github.workflow.run, github.workflow.jobLogs.get, github.repo.starred.list, github.repo.star, github.user.me.get, github.org.teams.list, github.team.members.list, github.user.search, github.notification.list, github.notification.get, github.notification.markRead, github.notification.markAllRead, github.gist.create, github.gist.get, github.gist.list, github.gist.update\n Example: tool=\"github\", action=\"github.issue.create\", parameters={\"owner\": \"org\", \"repo\": \"repo\", \"title\": \"Bug report\", \"body\": \"Details...\"}\n Example: tool=\"github\", action=\"github.pr.create\", parameters={\"owner\": \"org\", \"repo\": \"repo\", \"title\": \"Fix bug\", \"head\": \"feature-branch\", \"base\": \"main\"}\n Example: tool=\"github\", action=\"github.content.get\", parameters={\"owner\": \"org\", \"repo\": \"repo\", \"path\": \"README.md\"}\n\n**jira** \u2014 Manage issues, projects, boards, sprints.\n Common actions: jira.issue.create, jira.issue.search, jira.project.read\n\n**gmail** \u2014 Search/read/send/draft/delete emails, list labels.\n Common actions: gmail.message.search, gmail.message.read, gmail.message.send, gmail.draft.create, gmail.label.read\n Example (new email): tool=\"gmail\", action=\"gmail.message.send\", parameters={\"to\": \"user@example.com\", \"subject\": \"Hello\", \"body\": \"Message content\"}\n Example (draft): tool=\"gmail\", action=\"gmail.draft.create\", parameters={\"to\": \"user@example.com\", \"subject\": \"Draft subject\", \"body\": \"Draft content\"}\n Example (search): tool=\"gmail\", action=\"gmail.message.search\", parameters={\"query\": \"from:boss subject:urgent\"}\n **Replying to emails**: When replying, you MUST include threading parameters to ensure the reply is properly threaded:\n 1. First read the original message with gmail.message.read to get its threadId and Message-ID header (look for {name: \"Message-ID\", value: \"...\"} in the payload.headers array).\n 2. Then send with: threadId (from the read response top-level field), inReplyTo (the Message-ID header value), references (space-separated Message-IDs for the full thread chain; for a first reply, just the single Message-ID).\n Example (reply): tool=\"gmail\", action=\"gmail.message.send\", parameters={\"to\": \"sender@example.com\", \"subject\": \"Re: Original Subject\", \"body\": \"Reply content\", \"threadId\": \"18e1234abcd\", \"inReplyTo\": \"<CABx...@mail.gmail.com>\", \"references\": \"<CABx...@mail.gmail.com>\"}\n\n**outlook** \u2014 Search/read/send/draft Outlook (Microsoft 365) email, list mail folders, trash or permanently delete messages. This is a SEPARATE tool from gmail \u2014 for a user connected via Microsoft, use tool=\"outlook\" with outlook.* actions; do not send gmail.* actions to it.\n Common actions: outlook.message.search, outlook.message.read, outlook.message.send, outlook.draft.create, outlook.folder.read, outlook.message.trash, outlook.message.delete, outlook.batch.read\n Example (new email): tool=\"outlook\", action=\"outlook.message.send\", parameters={\"to\": \"user@example.com\", \"subject\": \"Hello\", \"body\": \"Message content\"}\n Example (search): tool=\"outlook\", action=\"outlook.message.search\", parameters={\"query\": \"from:boss subject:urgent\"}\n Example (read): tool=\"outlook\", action=\"outlook.message.read\", parameters={\"messageId\": \"<id from a search result>\"}\n Example (draft): tool=\"outlook\", action=\"outlook.draft.create\", parameters={\"to\": \"user@example.com\", \"subject\": \"Draft subject\", \"body\": \"Draft content\"}\n Recipients (to/cc/bcc) are comma-separated address strings. The body is plain text. Read/search results are compacted (decoded body text, key headers, flags \u2014 no attachment binaries). Use outlook.message.trash to move a message to Deleted Items (recoverable) and outlook.message.delete only for a permanent, irreversible delete.\n\n**calendar** \u2014 List/create/update/delete calendar events. Works with whichever calendar the user connected \u2014 Google Calendar or Microsoft Outlook; the actions, parameters and response shape are identical for both, so never assume a provider.\n Common actions: calendar.event.list, calendar.event.create\n IMPORTANT: start and end MUST be objects with dateTime property, not flat strings.\n Example: tool=\"calendar\", action=\"calendar.event.create\", parameters={\"summary\": \"Meeting\", \"start\": {\"dateTime\": \"2026-07-15T10:00:00\", \"timeZone\": \"Asia/Tokyo\"}, \"end\": {\"dateTime\": \"2026-07-15T11:00:00\", \"timeZone\": \"Asia/Tokyo\"}}\n Example (with an online meeting): tool=\"calendar\", action=\"calendar.event.create\", parameters={\"summary\": \"Sync\", \"start\": {\"dateTime\": \"2026-07-15T10:00:00\", \"timeZone\": \"Asia/Tokyo\"}, \"end\": {\"dateTime\": \"2026-07-15T10:30:00\", \"timeZone\": \"Asia/Tokyo\"}, \"attendees\": [{\"email\": \"them@example.com\"}], \"addMeet\": true, \"meetRequestId\": \"<stable unique id>\"}\n To attach an online meeting link, use addMeet/meetRequestId \u2014 the provider mints it (Google Meet on Google, Teams on Outlook). Raw conferenceData/conferenceDataVersion parameters are NOT supported and will be ignored.\n Events come back in one provider-neutral shape: id, summary, start/end, attendees, location, conferenceUrl (the meeting join URL), htmlLink. Read the join URL from conferenceUrl \u2014 provider-specific fields such as hangoutLink are not returned.\n\n**hubspot** \u2014 Read/search/create CRM objects (contacts, companies, deals), properties, associations, engagements.\n Common actions: hubspot.crm.objects.search, hubspot.crm.objects.list, hubspot.crm.objects.batchCreate, hubspot.crm.properties.list, hubspot.crm.engagements.create, hubspot.crm.associations.list, hubspot.account.userDetails.get\n Most CRM actions require an \"objectType\" parameter (e.g. \"contacts\", \"companies\", \"deals\", or a custom object type ID).\n Example (search): tool=\"hubspot\", action=\"hubspot.crm.objects.search\", parameters={\"objectType\": \"contacts\", \"query\": \"acme\"}\n Example (create): tool=\"hubspot\", action=\"hubspot.crm.objects.batchCreate\", parameters={\"objectType\": \"contacts\", \"inputs\": [{\"properties\": {\"email\": \"jane@example.com\", \"firstname\": \"Jane\"}}]}\n For hubspot.crm.engagements.create use parameter key \"type\" (not \"engagementType\"); values \"NOTE\"/\"TASK\". ownerId comes from hubspot.account.userDetails.get.\n\n**linear** \u2014 Linear issue tracker with full CRUD for issues, comments, projects, and more.\n Issue operations: linear.issue.list, linear.issue.read, linear.issue.search, linear.issue.create, linear.issue.update, linear.issue.archive, linear.issue.unarchive, linear.issue.delete, linear.issue.addLabel, linear.issue.removeLabel, linear.issue.subscribe\n Comment management: linear.comment.create, linear.comment.list, linear.comment.update, linear.comment.delete, linear.comment.resolve, linear.comment.unresolve\n Issue relations: linear.issueRelation.create, linear.issueRelation.list, linear.issueRelation.delete\n Cycles/Sprints: linear.cycle.list, linear.cycle.read, linear.cycle.create, linear.cycle.update\n Labels: linear.label.list, linear.label.create, linear.label.update\n Attachments: linear.attachment.create, linear.attachment.list, linear.attachment.delete\n Projects: linear.project.list, linear.project.read, linear.project.create, linear.project.update\n Other: linear.team.list, linear.workflowState.list, linear.viewer.read, linear.user.list\n Example: { \"tool\": \"linear\", \"action\": \"linear.issue.list\", \"parameters\": { \"teamId\": \"<team-id>\", \"limit\": 20 } }\n Example (create): { \"tool\": \"linear\", \"action\": \"linear.issue.create\", \"parameters\": { \"teamId\": \"<team-id>\", \"title\": \"Bug report\" } }\n Use linear.team.list to discover teamIds, and linear.workflowState.list to find valid state IDs.\n\n\n**scheduling / inbox** \u2014 Meeting-time negotiation and task requests between users (signed as verifiable credentials).\n Common actions: scheduling.request, scheduling.session.create, inbox.check, inbox.respond, inbox.complete, inbox.send\n Scheduling routing: if the user gives a specific agreed meeting time, create the calendar\n event directly (calendar.event.create). If the time is NOT yet agreed and needs coordination,\n do NOT create the event \u2014 compute candidate slots from calendar.event.list first, then\n COUNT THE OTHER PEOPLE:\n - ONE counterpart (\"X\u3055\u3093\u3068\u65E5\u7A0B\u8ABF\u6574\", \"find a time with X\") -> scheduling.request.\n - TWO OR MORE counterparts (\"A \u3068 B \u3068 \u6253\u3061\u5408\u308F\u305B\", \"the four of us\", several addresses\n in one ask) -> scheduling.session.create, then scheduling.coordinate with the candidate\n slots. The 'to' on scheduling.request is a SINGLE address, so calling it once per person\n is NOT the multi-person path: that creates independent negotiations that can settle on\n DIFFERENT times, with no slot everyone shares and no single confirmation step.\n scheduling.coordinate folds every reply into the slots EVERYONE can make, and\n scheduling.finalize books it once. scheduling.coordinate also returns an inviteUrl per\n participant \u2014 show them to the user, since the notification email may not arrive. scheduling.coordinate also returns an\n expiresAt: the answer window CLOSES then, defaults to 48h, and can land BEFORE the\n proposed dates \u2014 tell the user that date, and pass an explicit 'deadline' to\n scheduling.session.create when the meeting is further out. Before scheduling.finalize,\n call scheduling.session.status to see whether people actually answered (counts and the\n common slots, never who said what); finalizing without it is a guess.\n\n There are TWO roles \u2014 act according to which side you are on:\n - Requester flow (you initiate): scheduling.request sends candidate slots. The counterpart's\n human-approved response arrives in YOUR inbox.check as an item with role: \"sent\". BRANCH ON status\n \u2014 but what a status MEANS depends on its taskType, so read the item's taskType first.\n For a SCHEDULING item (taskType \"scheduling\"):\n \u2022 status \"completed\": the meeting was ALREADY auto-confirmed and booked server-side \u2014 the item\n carries a calendarEventId and htmlLink (plus the online-meeting link). You are DONE: do NOT call\n calendar.event.create (it would create a duplicate). Just tell the user the confirmed date/time\n and the meeting link. (When the sender's delegation policy authorizes it, the server confirms and\n books automatically the moment the counterpart approves; otherwise the item stays \"processing\".)\n \u2022 status \"processing\": awaiting manual confirmation \u2014 confirm the chosen slot with the user, create\n the calendar event with calendar.event.create (add the counterpart to attendees so the calendar\n invite goes out), then call inbox.complete. Set addMeet: true and meetRequestId to the inbox item id\n (idempotent \u2014 retries won't mint duplicate meetings) for the online-meeting link \u2014 Google Meet on a\n Google connection, Microsoft Teams on an Outlook one. A \"processing\" item can be\n auto-confirmed right after you observe it, so re-check before booking and never race ahead.\n \u2022 status \"declined\": inform the user and do not book \u2014 the negotiation is over.\n For any NON-scheduling item (e.g. taskType \"doc_review\"):\n \u2022 status \"completed\": the recipient delivered the result and the task is FINISHED. The result is in\n the item's responseData \u2014 report THAT. There is no calendar event, no confirmed time and no Meet\n link on such an item, so do not look for or invent a calendarEventId, a confirmed time, or a\n Meet link (none exists), and do not call calendar.event.create.\n \u2022 status \"declined\": the recipient did not carry out the task \u2014 inform the user.\n - Recipient flow (someone sent YOU a request): it appears in inbox.check with role: \"received\" \u2192\n confirm with the user \u2192 reply with inbox.respond. That is the end of your job.\n Do NOT create a calendar event when you are the recipient \u2014 the sender books it (or the server\n auto-confirms it under the sender's delegation) and you will receive a calendar invite.\n When a received scheduling request surfaces, do not just list the candidates \u2014 in the same turn,\n check the user's calendar (calendar.event.list over the candidate windows), determine which\n candidates are free, and present: the request summary, which slots are open, your recommended\n slot, and a confirmation question. Only call inbox.respond after the user confirms.\n\n inbox.check results are point-in-time \u2014 when the user asks about responses or new requests,\n ALWAYS call inbox.check again; never answer from a previous check result.\n\n Example: tool=\"scheduling\", action=\"scheduling.request\", parameters={\"to\": \"them@example.com\", \"topic\": \"sync\", \"durationMinutes\": 30, \"candidates\": [{\"start\": \"2026-06-12T10:00:00+09:00\", \"end\": \"2026-06-12T10:30:00+09:00\"}]}\n The response includes a schedulingUrl \u2014 always show it to the user so it can be shared via another channel if needed (the notification email is sent automatically but may not arrive).\n inbox.send is the low-level primitive for other task types.\n Example: tool=\"inbox\", action=\"inbox.check\", parameters={}\n Example (recipient responds to a request): tool=\"inbox\", action=\"inbox.respond\", parameters={\"id\": \"<inbox item id from inbox.check>\", \"action\": \"accept\", \"data\": {\"selectedSlot\": {\"start\": \"2026-06-18T14:00:00+09:00\", \"end\": \"2026-06-18T15:00:00+09:00\"}}}\n Example (requester completes after booking): tool=\"inbox\", action=\"inbox.complete\", parameters={\"id\": \"<inbox item id>\", \"result\": {\"calendarEventId\": \"...\", \"meetUrl\": \"...\"}}\n\nCall aidentity_list_available_tools for detailed parameter schemas of each action.";
3
+ export declare const CALL_TOOL_DESCRIPTION = "Execute an action on an external service or local resource on behalf of the user.\nThis is the PRIMARY tool \u2014 always use this to perform actions. Permission is handled in-band:\n- Actions the user has delegated run immediately.\n- External-service actions that need the user's approval return status \"pending\" with a request_id and an approval URL. Present the URL to the user. Do NOT call this tool again for the same action: once the user approves, the call runs with exactly the arguments you sent. Read the outcome with aidentity_get_result { request_id }.\n- Local actions (os.*) that need approval return waiting_for_approval with an approval URL and a requestId; after the user approves in the browser, call this tool again with the same action and pendingRequestId.\n- Actions the user's settings do not permit are refused; approving case by case is not possible for those.\nDo NOT call aidentity_request_permission first; just call this tool directly.\n\nSupported tools and common actions:\n\n**os** \u2014 Read/write local secret files (.env, credentials, etc.)\n Actions: os.secret.read, os.secret.write\n Example: tool=\"os\", action=\"os.secret.read\", parameters={\"file_path\": \"~/projects/app/.env\"}\n\n**slack** \u2014 Post/read/update/delete messages, list channels, get user info.\n Common actions: slack.message.post, slack.message.read, slack.channel.read, slack.batch.read\n The \"channel\" parameter accepts channel ID (e.g. \"C0A159PP6QM\"), channel name (e.g. \"general\"), or #-prefixed name (e.g. \"#general\"). Responses are compact by default (essential fields only). Set compact=false for full Slack API response.\n Example: tool=\"slack\", action=\"slack.message.post\", parameters={\"channel\": \"C01ABCD2EFG\", \"text\": \"Hello!\"}\n Example: tool=\"slack\", action=\"slack.message.read\", parameters={\"channel\": \"C01ABCD2EFG\", \"limit\": 10}\n\n**github** \u2014 Create/read/update/list issues, pull requests, repositories, contents, labels, Actions workflows, stars, users, notifications and gists.\n Common actions: github.issue.create, github.issue.list, github.issue.read, github.issue.search, github.issue.comment.create, github.pr.create, github.pr.list, github.pr.read, github.pr.merge, github.repo.search, github.content.get, github.content.createOrUpdate, github.branch.list, github.branch.create, github.commit.list, github.code.search, github.repo.create, github.repo.fork, github.label.list, github.label.write, github.workflow.list, github.workflow.run, github.workflow.jobLogs.get, github.repo.starred.list, github.repo.star, github.user.me.get, github.org.teams.list, github.team.members.list, github.user.search, github.notification.list, github.notification.get, github.notification.markRead, github.notification.markAllRead, github.gist.create, github.gist.get, github.gist.list, github.gist.update\n Example: tool=\"github\", action=\"github.issue.create\", parameters={\"owner\": \"org\", \"repo\": \"repo\", \"title\": \"Bug report\", \"body\": \"Details...\"}\n Example: tool=\"github\", action=\"github.pr.create\", parameters={\"owner\": \"org\", \"repo\": \"repo\", \"title\": \"Fix bug\", \"head\": \"feature-branch\", \"base\": \"main\"}\n Example: tool=\"github\", action=\"github.content.get\", parameters={\"owner\": \"org\", \"repo\": \"repo\", \"path\": \"README.md\"}\n\n**jira** \u2014 Manage issues, projects, boards, sprints.\n Common actions: jira.issue.create, jira.issue.search, jira.project.read\n\n**gmail** \u2014 Search/read/send/draft/delete emails, list labels.\n Common actions: gmail.message.search, gmail.message.read, gmail.message.send, gmail.draft.create, gmail.label.read\n Example (new email): tool=\"gmail\", action=\"gmail.message.send\", parameters={\"to\": \"user@example.com\", \"subject\": \"Hello\", \"body\": \"Message content\"}\n Example (draft): tool=\"gmail\", action=\"gmail.draft.create\", parameters={\"to\": \"user@example.com\", \"subject\": \"Draft subject\", \"body\": \"Draft content\"}\n Example (search): tool=\"gmail\", action=\"gmail.message.search\", parameters={\"query\": \"from:boss subject:urgent\"}\n **Replying to emails**: When replying, you MUST include threading parameters to ensure the reply is properly threaded:\n 1. First read the original message with gmail.message.read to get its threadId and Message-ID header (look for {name: \"Message-ID\", value: \"...\"} in the payload.headers array).\n 2. Then send with: threadId (from the read response top-level field), inReplyTo (the Message-ID header value), references (space-separated Message-IDs for the full thread chain; for a first reply, just the single Message-ID).\n Example (reply): tool=\"gmail\", action=\"gmail.message.send\", parameters={\"to\": \"sender@example.com\", \"subject\": \"Re: Original Subject\", \"body\": \"Reply content\", \"threadId\": \"18e1234abcd\", \"inReplyTo\": \"<CABx...@mail.gmail.com>\", \"references\": \"<CABx...@mail.gmail.com>\"}\n\n**outlook** \u2014 Search/read/send/draft Outlook (Microsoft 365) email, list mail folders, trash or permanently delete messages. This is a SEPARATE tool from gmail \u2014 for a user connected via Microsoft, use tool=\"outlook\" with outlook.* actions; do not send gmail.* actions to it.\n Common actions: outlook.message.search, outlook.message.read, outlook.message.send, outlook.draft.create, outlook.folder.read, outlook.message.trash, outlook.message.delete, outlook.batch.read\n Example (new email): tool=\"outlook\", action=\"outlook.message.send\", parameters={\"to\": \"user@example.com\", \"subject\": \"Hello\", \"body\": \"Message content\"}\n Example (search): tool=\"outlook\", action=\"outlook.message.search\", parameters={\"query\": \"from:boss subject:urgent\"}\n Example (read): tool=\"outlook\", action=\"outlook.message.read\", parameters={\"messageId\": \"<id from a search result>\"}\n Example (draft): tool=\"outlook\", action=\"outlook.draft.create\", parameters={\"to\": \"user@example.com\", \"subject\": \"Draft subject\", \"body\": \"Draft content\"}\n Recipients (to/cc/bcc) are comma-separated address strings. The body is plain text. Read/search results are compacted (decoded body text, key headers, flags \u2014 no attachment binaries). Use outlook.message.trash to move a message to Deleted Items (recoverable) and outlook.message.delete only for a permanent, irreversible delete.\n\n**calendar** \u2014 List/create/update/delete calendar events. Works with whichever calendar the user connected \u2014 Google Calendar or Microsoft Outlook; the actions, parameters and response shape are identical for both, so never assume a provider.\n Common actions: calendar.event.list, calendar.event.create\n IMPORTANT: start and end MUST be objects with dateTime property, not flat strings.\n Example: tool=\"calendar\", action=\"calendar.event.create\", parameters={\"summary\": \"Meeting\", \"start\": {\"dateTime\": \"2026-07-15T10:00:00\", \"timeZone\": \"Asia/Tokyo\"}, \"end\": {\"dateTime\": \"2026-07-15T11:00:00\", \"timeZone\": \"Asia/Tokyo\"}}\n Example (with an online meeting): tool=\"calendar\", action=\"calendar.event.create\", parameters={\"summary\": \"Sync\", \"start\": {\"dateTime\": \"2026-07-15T10:00:00\", \"timeZone\": \"Asia/Tokyo\"}, \"end\": {\"dateTime\": \"2026-07-15T10:30:00\", \"timeZone\": \"Asia/Tokyo\"}, \"attendees\": [{\"email\": \"them@example.com\"}], \"addMeet\": true, \"meetRequestId\": \"<stable unique id>\"}\n To attach an online meeting link, use addMeet/meetRequestId \u2014 the provider mints it (Google Meet on Google, Teams on Outlook). Raw conferenceData/conferenceDataVersion parameters are NOT supported and will be ignored.\n Events come back in one provider-neutral shape: id, summary, start/end, attendees, location, conferenceUrl (the meeting join URL), htmlLink. Read the join URL from conferenceUrl \u2014 provider-specific fields such as hangoutLink are not returned.\n\n**hubspot** \u2014 Read/search/create CRM objects (contacts, companies, deals), properties, associations, engagements.\n Common actions: hubspot.crm.objects.search, hubspot.crm.objects.list, hubspot.crm.objects.batchCreate, hubspot.crm.properties.list, hubspot.crm.engagements.create, hubspot.crm.associations.list, hubspot.account.userDetails.get\n Most CRM actions require an \"objectType\" parameter (e.g. \"contacts\", \"companies\", \"deals\", or a custom object type ID).\n Example (search): tool=\"hubspot\", action=\"hubspot.crm.objects.search\", parameters={\"objectType\": \"contacts\", \"query\": \"acme\"}\n Example (create): tool=\"hubspot\", action=\"hubspot.crm.objects.batchCreate\", parameters={\"objectType\": \"contacts\", \"inputs\": [{\"properties\": {\"email\": \"jane@example.com\", \"firstname\": \"Jane\"}}]}\n For hubspot.crm.engagements.create use parameter key \"type\" (not \"engagementType\"); values \"NOTE\"/\"TASK\". ownerId comes from hubspot.account.userDetails.get.\n\n**linear** \u2014 Linear issue tracker with full CRUD for issues, comments, projects, and more.\n Issue operations: linear.issue.list, linear.issue.read, linear.issue.search, linear.issue.create, linear.issue.update, linear.issue.archive, linear.issue.unarchive, linear.issue.delete, linear.issue.addLabel, linear.issue.removeLabel, linear.issue.subscribe\n Comment management: linear.comment.create, linear.comment.list, linear.comment.update, linear.comment.delete, linear.comment.resolve, linear.comment.unresolve\n Issue relations: linear.issueRelation.create, linear.issueRelation.list, linear.issueRelation.delete\n Cycles/Sprints: linear.cycle.list, linear.cycle.read, linear.cycle.create, linear.cycle.update\n Labels: linear.label.list, linear.label.create, linear.label.update\n Attachments: linear.attachment.create, linear.attachment.list, linear.attachment.delete\n Projects: linear.project.list, linear.project.read, linear.project.create, linear.project.update\n Other: linear.team.list, linear.workflowState.list, linear.viewer.read, linear.user.list\n Example: { \"tool\": \"linear\", \"action\": \"linear.issue.list\", \"parameters\": { \"teamId\": \"<team-id>\", \"limit\": 20 } }\n Example (create): { \"tool\": \"linear\", \"action\": \"linear.issue.create\", \"parameters\": { \"teamId\": \"<team-id>\", \"title\": \"Bug report\" } }\n Use linear.team.list to discover teamIds, and linear.workflowState.list to find valid state IDs.\n\n\n**scheduling / inbox** \u2014 Meeting-time negotiation and task requests between users (signed as verifiable credentials).\n Common actions: scheduling.request, scheduling.session.create, inbox.check, inbox.respond, inbox.complete, inbox.send\n Scheduling routing: if the user gives a specific agreed meeting time, create the calendar\n event directly (calendar.event.create). If the time is NOT yet agreed and needs coordination,\n do NOT create the event \u2014 compute candidate slots from calendar.event.list first, then\n COUNT THE OTHER PEOPLE:\n - ONE counterpart (\"X\u3055\u3093\u3068\u65E5\u7A0B\u8ABF\u6574\", \"find a time with X\") -> scheduling.request.\n - TWO OR MORE counterparts (\"A \u3068 B \u3068 \u6253\u3061\u5408\u308F\u305B\", \"the four of us\", several addresses\n in one ask) -> scheduling.session.create, then scheduling.coordinate with the candidate\n slots. The 'to' on scheduling.request is a SINGLE address, so calling it once per person\n is NOT the multi-person path: that creates independent negotiations that can settle on\n DIFFERENT times, with no slot everyone shares and no single confirmation step.\n scheduling.coordinate folds every reply into the slots EVERYONE can make, and\n scheduling.finalize books it once. scheduling.coordinate also returns an inviteUrl per\n participant \u2014 show them to the user, since the notification email may not arrive. scheduling.coordinate also returns an\n expiresAt: the answer window CLOSES then, defaults to 48h, and can land BEFORE the\n proposed dates \u2014 tell the user that date, and pass an explicit 'deadline' to\n scheduling.session.create when the meeting is further out. Before scheduling.finalize,\n call scheduling.session.status to see whether people actually answered (counts and the\n common slots, never who said what); finalizing without it is a guess.\n\n There are TWO roles \u2014 act according to which side you are on:\n - Requester flow (you initiate): scheduling.request sends candidate slots. The counterpart's\n human-approved response arrives in YOUR inbox.check as an item with role: \"sent\". BRANCH ON status\n \u2014 but what a status MEANS depends on its taskType, so read the item's taskType first.\n For a SCHEDULING item (taskType \"scheduling\"):\n \u2022 status \"completed\": the meeting was ALREADY auto-confirmed and booked server-side \u2014 the item\n carries a calendarEventId and htmlLink (plus the online-meeting link). You are DONE: do NOT call\n calendar.event.create (it would create a duplicate). Just tell the user the confirmed date/time\n and the meeting link. (When the sender's delegation policy authorizes it, the server confirms and\n books automatically the moment the counterpart approves; otherwise the item stays \"processing\".)\n \u2022 status \"processing\": awaiting manual confirmation \u2014 confirm the chosen slot with the user, create\n the calendar event with calendar.event.create (add the counterpart to attendees so the calendar\n invite goes out), then call inbox.complete. Set addMeet: true and meetRequestId to the inbox item id\n (idempotent \u2014 retries won't mint duplicate meetings) for the online-meeting link \u2014 Google Meet on a\n Google connection, Microsoft Teams on an Outlook one. A \"processing\" item can be\n auto-confirmed right after you observe it, so re-check before booking and never race ahead.\n \u2022 status \"declined\": inform the user and do not book \u2014 the negotiation is over.\n For any NON-scheduling item (e.g. taskType \"doc_review\"):\n \u2022 status \"completed\": the recipient delivered the result and the task is FINISHED. The result is in\n the item's responseData \u2014 report THAT. There is no calendar event, no confirmed time and no Meet\n link on such an item, so do not look for or invent a calendarEventId, a confirmed time, or a\n Meet link (none exists), and do not call calendar.event.create.\n \u2022 status \"declined\": the recipient did not carry out the task \u2014 inform the user.\n - Recipient flow (someone sent YOU a request): it appears in inbox.check with role: \"received\" \u2192\n confirm with the user \u2192 reply with inbox.respond. That is the end of your job.\n Do NOT create a calendar event when you are the recipient \u2014 the sender books it (or the server\n auto-confirms it under the sender's delegation) and you will receive a calendar invite.\n When a received scheduling request surfaces, do not just list the candidates \u2014 in the same turn,\n check the user's calendar (calendar.event.list over the candidate windows), determine which\n candidates are free, and present: the request summary, which slots are open, your recommended\n slot, and a confirmation question. Only call inbox.respond after the user confirms.\n\n inbox.check results are point-in-time \u2014 when the user asks about responses or new requests,\n ALWAYS call inbox.check again; never answer from a previous check result.\n\n Example: tool=\"scheduling\", action=\"scheduling.request\", parameters={\"to\": \"them@example.com\", \"topic\": \"sync\", \"durationMinutes\": 30, \"candidates\": [{\"start\": \"2026-06-12T10:00:00+09:00\", \"end\": \"2026-06-12T10:30:00+09:00\"}]}\n The response includes a schedulingUrl \u2014 always show it to the user so it can be shared via another channel if needed (the notification email is sent automatically but may not arrive).\n inbox.send is the low-level primitive for other task types.\n Example: tool=\"inbox\", action=\"inbox.check\", parameters={}\n Example (recipient responds to a request): tool=\"inbox\", action=\"inbox.respond\", parameters={\"id\": \"<inbox item id from inbox.check>\", \"action\": \"accept\", \"data\": {\"selectedSlot\": {\"start\": \"2026-06-18T14:00:00+09:00\", \"end\": \"2026-06-18T15:00:00+09:00\"}}}\n Example (requester completes after booking): tool=\"inbox\", action=\"inbox.complete\", parameters={\"id\": \"<inbox item id>\", \"result\": {\"calendarEventId\": \"...\", \"meetUrl\": \"...\"}}\n\nCall aidentity_list_available_tools for detailed parameter schemas of each action.";
4
4
  export declare const SERVER_INSTRUCTIONS = "This server provides identity-verified tool execution (VESS AIDENTITY).\nScheduling: if the user gives a specific agreed time, create the calendar event\ndirectly. If the time is not yet agreed (\"\u65E5\u7A0B\u8ABF\u6574\", \"find a time\"), compute candidate\nslots from the user's calendar \u2014 then count the other people. ONE counterpart:\nscheduling.request, then wait for the response. TWO OR MORE: scheduling.session.create\nfollowed by scheduling.coordinate (scheduling.request takes a single 'to', so sending it\nonce per person makes separate negotiations that can settle on different times).\nCheck progress with scheduling.session.status before scheduling.finalize, and tell the\nuser the expiresAt that coordinate returns (the answer window defaults to 48h).\nSize candidateWindow to the user's intent. candidateWindow is a { start, end } range OR an array of\nranges (max 5, total span \u2264 62 days); the server searches each range independently and spreads\ncandidates across them. A specific named day \u2192 one range for that day. A per-day time band\n(\"\u5E73\u65E5\u5348\u5F8C\") \u2192 one range PER business day ([{Mon 13-18}, {Tue 13-18}, \u2026]) so the band is honored\nevery day. Distinct bands (\"\u6708\u66DC\u5348\u524D or \u6728\u66DC\u5348\u5F8C\") \u2192 one range each. A single open stretch\n(\"next week\", \"\u5E73\u65E5\u3067\") \u2192 one wide range spanning the business days.\nAt session start, call inbox.check once to surface pending task requests (role \"received\") AND\nresponses to your own requests (role \"sent\"). As the requester, branch on the sent item's status \u2014\nwhat a status means depends on its taskType, so read the item's taskType first.\nFor a SCHEDULING item: \"completed\" means the server already auto-confirmed and booked it\n(calendarEventId + Meet link present) \u2014 do NOT create the event again, just tell the user the\nconfirmed time and Meet link; \"processing\" means confirm with the user, then create the event\n(adding the counterpart to attendees) and call inbox.complete; \"declined\" means inform the user and\ndo not book. For any NON-scheduling item (e.g. taskType \"doc_review\"): \"completed\" means the\nrecipient delivered the result and the task is finished \u2014 the result is in the item's responseData,\nso report THAT and do not look for or invent a calendar event, a confirmed time, or a Meet link\n(none exists); \"declined\" means the recipient did not carry out the task \u2014 inform the user.\nAs the recipient, reply with inbox.respond and stop \u2014\ndo not create the calendar event; the sender books it (or the server auto-confirms it under the\nsender's delegation) and you will receive a calendar invite.\nAs the recipient, do not just list the candidates \u2014 in the same turn check the user's calendar over\nthe candidate windows, determine which slots are free, and present the request summary, the open slots,\nyour recommended slot, and a confirmation question; only call inbox.respond after the user confirms.\ninbox.check results are point-in-time \u2014 when the user asks about responses or new requests,\nALWAYS call inbox.check again; never answer from a previous check result.\nTask requests/responses are signed as verifiable credentials.";
5
+ /** Same text as remote-mcp's `GET_RESULT_DESCRIPTION`. */
6
+ export declare const GET_RESULT_DESCRIPTION: string;
5
7
  export interface MCPToolHandler {
6
8
  callTool(args: {
7
9
  tool: string;
@@ -39,6 +41,11 @@ export interface MCPToolHandler {
39
41
  data?: any;
40
42
  error?: string;
41
43
  }>;
44
+ getResult(requestId: string): Promise<{
45
+ success: boolean;
46
+ data?: any;
47
+ error?: string;
48
+ }>;
42
49
  }
43
50
  export declare function createMcpServer(handler: MCPToolHandler): McpServer;
44
51
  //# sourceMappingURL=mcp-server.factory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-server.factory.d.ts","sourceRoot":"","sources":["../../../src/adapter/mcp/m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AAC,EAAE,MAAM,CAAA;QACd,gBAAgB,CAAC,EAAE,GAAG,CAAA;QACtB,kBAAkB,CAAC,EAAE,GAAG,CAAA;QACxB,cAAc,CAAC,EAAE,2BAA2B,CAAA;KAC7C,CAAC,CAAA;IACF,mBAAmB,CAAC,IAAI,EAAE;QACxB,IAAI,EAAE,MAAM,CAAA;QACZ,OAAO,EAAE,MAAM,EAAE,CAAA;KAClB,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,IAAI,CAAC,EAAE,GAAG,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAC7D,kBAAkB,IAAI,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,IAAI,CAAC,EAAE,GAAG,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IAC/E,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,IAAI,CAAC,EAAE,GAAG,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CACxF;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,cAAc,GAAG,SAAS,CAoNlE"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SERVER_INSTRUCTIONS = exports.CALL_TOOL_DESCRIPTION = void 0;
3
+ exports.GET_RESULT_DESCRIPTION = exports.SERVER_INSTRUCTIONS = exports.CALL_TOOL_DESCRIPTION = void 0;
4
4
  exports.createMcpServer = createMcpServer;
5
5
  const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
6
6
  const ai_identity_1 = require("@vess-id/ai-identity");
@@ -12,9 +12,11 @@ const toolEnum = zod_1.z.enum(ai_identity_1.VALID_MCP_TOOLS);
12
12
  const ACTION_FORMAT_DESC = 'Action in provider.resource.operation format. Valid actions: ' +
13
13
  (0, ai_identity_1.getAllValidMcpActionNames)().join(', ');
14
14
  exports.CALL_TOOL_DESCRIPTION = `Execute an action on an external service or local resource on behalf of the user.
15
- This is the PRIMARY tool — always use this to perform actions. Permission is handled automatically:
16
- - Read-type actions (low risk) are auto-approved and execute immediately.
17
- - Write-type actions that need approval will return an approval_required response. Re-call with the approval parameter to confirm or deny.
15
+ This is the PRIMARY tool — always use this to perform actions. Permission is handled in-band:
16
+ - Actions the user has delegated run immediately.
17
+ - External-service actions that need the user's approval return status "pending" with a request_id and an approval URL. Present the URL to the user. Do NOT call this tool again for the same action: once the user approves, the call runs with exactly the arguments you sent. Read the outcome with aidentity_get_result { request_id }.
18
+ - Local actions (os.*) that need approval return waiting_for_approval with an approval URL and a requestId; after the user approves in the browser, call this tool again with the same action and pendingRequestId.
19
+ - Actions the user's settings do not permit are refused; approving case by case is not possible for those.
18
20
  Do NOT call aidentity_request_permission first; just call this tool directly.
19
21
 
20
22
  Supported tools and common actions:
@@ -184,6 +186,10 @@ your recommended slot, and a confirmation question; only call inbox.respond afte
184
186
  inbox.check results are point-in-time — when the user asks about responses or new requests,
185
187
  ALWAYS call inbox.check again; never answer from a previous check result.
186
188
  Task requests/responses are signed as verifiable credentials.`;
189
+ /** Same text as remote-mcp's `GET_RESULT_DESCRIPTION`. */
190
+ exports.GET_RESULT_DESCRIPTION = 'Read the outcome of an earlier aidentity_call_tool that returned status "pending" or "in_flight". ' +
191
+ 'Read-only: it takes only the request_id and never executes anything. ' +
192
+ 'If it still says "pending", the user has not approved yet; if "executing", ask again shortly.';
187
193
  function createMcpServer(handler) {
188
194
  const server = new mcp_js_1.McpServer({
189
195
  name: 'VESS',
@@ -210,16 +216,20 @@ function createMcpServer(handler) {
210
216
  const formatResult = (result) => {
211
217
  if (result.waitingForApproval) {
212
218
  return {
213
- content: [{
219
+ content: [
220
+ {
214
221
  type: 'text',
215
222
  text: JSON.stringify(result.waitingForApproval, null, 2),
216
- }],
223
+ },
224
+ ],
217
225
  isError: false,
218
226
  };
219
227
  }
220
228
  if (result.approvalRequired) {
221
229
  return {
222
- content: [{ type: 'text', text: JSON.stringify(result.approvalRequired, null, 2) }],
230
+ content: [
231
+ { type: 'text', text: JSON.stringify(result.approvalRequired, null, 2) },
232
+ ],
223
233
  isError: false,
224
234
  };
225
235
  }
@@ -245,28 +255,47 @@ function createMcpServer(handler) {
245
255
  tool: toolEnum,
246
256
  action: zod_1.z.string().describe(ACTION_FORMAT_DESC),
247
257
  parameters: zod_1.z.record(zod_1.z.string(), zod_1.z.any()).optional().describe('Tool-specific parameters'),
248
- approval: zod_1.z.object({
249
- token: zod_1.z.string().describe('HMAC-signed approval token from a previous approval_required response'),
250
- choice: zod_1.z.enum(['one_time', 'persistent', 'deny_once', 'deny_persistent']).describe('User approval choice'),
251
- vcTTLMinutes: zod_1.z.number().min(5).max(1440).optional().describe('Custom VC TTL in minutes (5-1440)'),
258
+ approval: zod_1.z
259
+ .object({
260
+ token: zod_1.z
261
+ .string()
262
+ .describe('HMAC-signed approval token from a previous approval_required response'),
263
+ choice: zod_1.z
264
+ .enum(['one_time', 'persistent', 'deny_once', 'deny_persistent'])
265
+ .describe('User approval choice'),
266
+ vcTTLMinutes: zod_1.z
267
+ .number()
268
+ .min(5)
269
+ .max(1440)
270
+ .optional()
271
+ .describe('Custom VC TTL in minutes (5-1440)'),
252
272
  // Cedar 一元化 Step 3.5 retry-path context, handed back by the
253
273
  // approval-outcome page after the user clicked 承認. Optional; when
254
274
  // all four are present the engine consumes the single-use ledger
255
275
  // token and lifts a prior Cedar `auth_required` → `permit`.
256
- request_id: zod_1.z.string().optional()
276
+ request_id: zod_1.z
277
+ .string()
278
+ .optional()
257
279
  .describe('Approval-request id (`req_<uuid>`) from the prior auth_required response'),
258
- outcome_id: zod_1.z.string().optional()
280
+ outcome_id: zod_1.z
281
+ .string()
282
+ .optional()
259
283
  .describe('Approval-outcome id (`outcome_<uuid>`) emitted when the user clicked 承認'),
260
284
  // deny intent flows via `choice` (deny_once | deny_persistent); the
261
285
  // `granted` boolean is not used for redeem (the ledger CAS is
262
286
  // authoritative), so it was removed as dead schema surface.
263
- granted_at: zod_1.z.string().optional()
264
- .describe('ISO-8601 timestamp of the approval action'),
265
- granted_by: zod_1.z.string().optional()
287
+ granted_at: zod_1.z.string().optional().describe('ISO-8601 timestamp of the approval action'),
288
+ granted_by: zod_1.z
289
+ .string()
290
+ .optional()
266
291
  .describe('User id, or the literal "system" for auto-approve'),
267
- }).optional().describe('Approval response — only provide when re-calling after an approval_required response'),
268
- pendingRequestId: zod_1.z.string().optional()
269
- .describe('Request ID from a previous waiting_for_approval response. Use to check if approval was completed.'),
292
+ })
293
+ .optional()
294
+ .describe('Deprecated: refused for every action (there is no approval hand-off through the tool call). Removed in a later release.'),
295
+ pendingRequestId: zod_1.z
296
+ .string()
297
+ .optional()
298
+ .describe('Local (os.*) actions only: the requestId from a previous waiting_for_approval response, to run the call after the user approved it in the browser. Refused for other actions — use aidentity_get_result with the request_id instead.'),
270
299
  },
271
300
  }, async (args) => {
272
301
  const result = await handler.callTool({
@@ -278,12 +307,26 @@ function createMcpServer(handler) {
278
307
  });
279
308
  return formatResult(result);
280
309
  });
310
+ registerTool('aidentity_get_result', {
311
+ description: exports.GET_RESULT_DESCRIPTION,
312
+ inputSchema: {
313
+ request_id: zod_1.z
314
+ .string()
315
+ .describe('request_id from an aidentity_call_tool response with status "pending" or "in_flight"'),
316
+ },
317
+ }, async (args) => {
318
+ // 🔴 Only the request id is read: anything else the LLM sends is ignored, so this tool cannot
319
+ // be used to trigger an execution.
320
+ const result = await handler.getResult(String(args?.request_id ?? ''));
321
+ return formatResult(result);
322
+ });
281
323
  registerTool('aidentity_request_permission', {
282
324
  description: 'OPTIONAL: Pre-request permission for multiple actions at once. ' +
283
325
  'In most cases, use aidentity_call_tool directly instead — it handles permissions automatically.',
284
326
  inputSchema: {
285
327
  tool: toolEnum,
286
- actions: zod_1.z.array(zod_1.z.string().describe(ACTION_FORMAT_DESC))
328
+ actions: zod_1.z
329
+ .array(zod_1.z.string().describe(ACTION_FORMAT_DESC))
287
330
  .describe('One or more actions to request permission for'),
288
331
  },
289
332
  }, async (args) => {
@@ -1 +1 @@
1
- {"version":3,"file":"mcp-server.factory.js","sourceRoot":"","sources":["../../../src/adapter/mcp/mcp-server.factory.ts"],"names":[],"mappings":";;;AA4NA,0CAkKC;AA9XD,oEAAmE;AACnE,sDAAiF;AACjF,6BAAuB;AACvB,kDAAkD;AAGlD,oEAAoE;AACpE,MAAM,QAAQ,GAAG,OAAC,CAAC,IAAI,CAAC,6BAAwC,CAAC,CAAA;AAEjE,4DAA4D;AAC5D,MAAM,kBAAkB,GACtB,+DAA+D;IAC/D,IAAA,uCAAyB,GAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAE3B,QAAA,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mFAyI8C,CAAA;AAEtE,QAAA,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8DAkC2B,CAAA;AAiC9D,SAAgB,eAAe,CAAC,OAAuB;IACrD,MAAM,MAAM,GAAG,IAAI,kBAAS,CAC1B;QACE,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE,qBAAW;KACrB,EACD,EAAE,YAAY,EAAE,2BAAmB,EAAE,CACtC,CAAA;IAED,4EAA4E;IAC5E,sEAAsE;IACtE,eAAe;IACf,0EAA0E;IAC1E,gEAAgE;IAChE,qEAAqE;IACrE,gEAAgE;IAChE,oEAAoE;IACpE,qEAAqE;IACrE,kCAAkC;IAClC,iEAAiE;IACjE,mEAAmE;IACnE,8DAA8D;IAC9D,oEAAoE;IACpE,oEAAoE;IACpE,+DAA+D;IAC/D,mDAAmD;IACnD,MAAM,Y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,EAC9B;QACE,WAAW,EACT,iEAAiE;YACjE,iGAAiG;QACnG,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,OAAC;iBACP,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC;iBAC9C,QAAQ,CAAC,+CAA+C,CAAC;SAC7D;KACF,EACD,KAAK,EAAE,IAAS,EAAE,EAAE;QAClB,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,mBAAmB,CAAC;YAC/C,IAAI,EAAE,IAAI,CAAC,IAAc;YACzB,OAAO,EAAE,IAAI,CAAC,OAAmB;SAClC,CAAC,CAAA;QACF,OAAO,YAAY,CAAC,MAAM,CAAC,CAAA;IAC7B,CAAC,CACF,CAAA;IAED,YAAY,CACV,gCAAgC,EAChC;QACE,WAAW,EAAE,uDAAuD;QACpE,mDAAmD;QACnD,gEAAgE;QAChE,+DAA+D;QAC/D,gEAAgE;QAChE,wDAAwD;QACxD,yBAAyB;QACzB,WAAW,EAAE,EAAE;KAChB,EACD,KAAK,IAAI,EAAE;QACT,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,kBAAkB,EAAE,CAAA;QACjD,OAAO,YAAY,CAAC,MAAM,CAAC,CAAA;IAC7B,CAAC,CACF,CAAA;IAED,OAAO,MAAM,CAAA;AACf,CAAC"}
@@ -9,7 +9,7 @@ export interface AuditEntry {
9
9
  action: string;
10
10
  provider?: string;
11
11
  enforcementType?: 'local' | 'gateway_verified_local' | 'cached_verified_local' | 'gateway';
12
- decisionSource?: 'local_policy' | 'org_policy' | 'cached_vc' | 'new_vc_from_quick_approve' | 'claimed_from_approval' | 'gateway_execution';
12
+ decisionSource?: 'local_policy' | 'org_policy' | 'cached_vc' | 'new_vc_from_quick_approve' | 'claimed_from_approval' | 'gateway_execution' | 'delegated_issuer';
13
13
  executionType: 'gateway' | 'local';
14
14
  decision: 'allow' | 'deny';
15
15
  decisionReason?: string;
@@ -1 +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,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CACnC;AAED,qBAAa,WAAW;IACV,OAAO,CAAC,QAAQ,CAAC,EAAE;gBAAF,EAAE,EAAE,QAAQ,CAAC,QAAQ;IAElD,QAAQ,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM;IA6CnC,gBAAgB,CAAC,KAAK,GAAE,MAAY,GAAG,CAAC,UAAU,GAAG;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC,EAAE;IAQtE,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI;IAW/B,OAAO,CAAC,UAAU;CAyBnB"}
@@ -10,7 +10,8 @@ class AuditLogger {
10
10
  logEvent(entry) {
11
11
  const id = entry.id || (0, crypto_1.randomUUID)();
12
12
  const timestamp = entry.timestamp || Date.now();
13
- this.db.prepare(`
13
+ this.db
14
+ .prepare(`
14
15
  INSERT INTO audit_log (
15
16
  id, timestamp, project_id, root_did, agent_did, presenter_did,
16
17
  action, provider, enforcement_type, decision_source,
@@ -19,12 +20,15 @@ class AuditLogger {
19
20
  grant_id, credential_id, approval_mode, approval_nonce,
20
21
  metadata, synced_at
21
22
  ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
22
- `).run(id, timestamp, entry.projectId ?? null, entry.rootDid ?? null, entry.agentDid ?? null, entry.presenterDid ?? null, entry.action, entry.provider ?? null, entry.enforcementType ?? null, entry.decisionSource ?? null, entry.executionType, entry.decision, entry.decisionReason ?? null, entry.requestedResource ?? null, entry.normalizedResource ?? null, entry.resourceFingerprint ?? null, entry.grantId ?? null, entry.credentialId ?? null, entry.approvalMode ?? null, entry.approvalNonce ?? null, entry.metadata ? JSON.stringify(entry.metadata) : null, null // synced_at = NULL (not yet synced)
23
+ `)
24
+ .run(id, timestamp, entry.projectId ?? null, entry.rootDid ?? null, entry.agentDid ?? null, entry.presenterDid ?? null, entry.action, entry.provider ?? null, entry.enforcementType ?? null, entry.decisionSource ?? null, entry.executionType, entry.decision, entry.decisionReason ?? null, entry.requestedResource ?? null, entry.normalizedResource ?? null, entry.resourceFingerprint ?? null, entry.grantId ?? null, entry.credentialId ?? null, entry.approvalMode ?? null, entry.approvalNonce ?? null, entry.metadata ? JSON.stringify(entry.metadata) : null, null // synced_at = NULL (not yet synced)
23
25
  );
24
26
  return id;
25
27
  }
26
28
  getPendingEvents(limit = 100) {
27
- const rows = this.db.prepare('SELECT * FROM audit_log WHERE synced_at IS NULL ORDER BY timestamp ASC LIMIT ?').all(limit);
29
+ const rows = this.db
30
+ .prepare('SELECT * FROM audit_log WHERE synced_at IS NULL ORDER BY timestamp ASC LIMIT ?')
31
+ .all(limit);
28
32
  return rows.map(r => this.rowToEntry(r));
29
33
  }
30
34
  markSynced(ids) {
@@ -1 +1 @@
1
- {"version":3,"file":"audit-logger.js","sourceRoot":"","sources":["../../src/audit/audit-logger.ts"],"names":[],"mappings":";;;AACA,mCAAmC;AA0BnC,MAAa,WAAW;IACO;IAA7B,YAA6B,EAAqB;QAArB,OAAE,GAAF,EAAE,CAAmB;IAAG,CAAC;IAEtD,QAAQ,CAAC,KAAiB;QACxB,MAAM,EAAE,GAAG,KAAK,CAAC,EAAE,IAAI,IAAA,mBAAU,GAAE,CAAA;QACnC,MAAM,SAAS,GAAG,KAAK,CAAC,SAAS,IAAI,IAAI,CAAC,GAAG,EAAE,CAAA;QAE/C,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC;;;;;;;;;KASf,CAAC,CAAC,GAAG,CACJ,EAAE,EAAE,SAAS,EACb,KAAK,CAAC,SAAS,IAAI,IAAI,EACvB,KAAK,CAAC,OAAO,IAAI,IAAI,EACrB,KAAK,CAAC,QAAQ,IAAI,IAAI,EACtB,KAAK,CAAC,YAAY,IAAI,IAAI,EAC1B,KAAK,CAAC,MAAM,EACZ,KAAK,CAAC,QAAQ,IAAI,IAAI,EACtB,KAAK,CAAC,eAAe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C,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG;IAAE,QAAQ,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,CAAA;CAAE,CAAA;AAE1F,iFAAiF;AACjF,wBAAgB,aAAa,CAAC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,YAAY,CAEjF;AAED,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC,uBAAuB,EAAE;IAAE,MAAM,EAAE,OAAO,CAAA;CAAE,CAAC,CAAA;AAElF,6FAA6F;AAC7F,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAA;IAChB,SAAS,EAAE,MAAM,CAAA;IACjB,kBAAkB,EAAE,MAAM,CAAA;IAC1B,UAAU,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,OAAO,CAAA;IAChB,IAAI,CAAC,EAAE,OAAO,CAAA;IACd,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,cAAc,CAAC,EAAE,kBAAkB,CAAA;IACnC;;;;;;OAMG;IACH,OAAO,EAAE,UAAU,GAAG,QAAQ,GAAG,yBAAyB,GAAG,eAAe,GAAG,SAAS,CAAA;CACzF;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,IAAI,CAAC,mBAAmB,EAAE,YAAY,GAAG,YAAY,GAAG,kBAAkB,CAAC,CAAA;IACpF,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,CAAA;CACtC;AAID;;;;;;;GAOG;AACH,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,mBAAmB,EACzB,GAAG,EAAE,aAAa,EAClB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,cAAc,GACpB,OAAO,CAAC,kBAAkB,CAAC,CAsC7B"}
@@ -20,6 +20,7 @@ exports.executeWithCredential = executeWithCredential;
20
20
  * simply did not happen.
21
21
  */
22
22
  const ai_identity_1 = require("@vess-id/ai-identity");
23
+ const gateway_client_1 = require("../gateway/gateway-client");
23
24
  /** Brand the `actionParams` of an issuer answer. Call it on API answers only. */
24
25
  function frozenFromApi(actionParams) {
25
26
  return actionParams;
@@ -128,6 +129,17 @@ async function invokePep(deps, ctx, action, params, vp, giveBack) {
128
129
  error: `"${action}" was refused by the gateway (${result.error || result.errorCode}). Nothing was done.`,
129
130
  outcome: 'refused_before_dispatch',
130
131
  };
132
+ case gateway_client_1.AGENTD_ERROR_CODE.ISSUANCE_CONSUMED:
133
+ // The PEP's single-use gate refused before dispatching: nothing was sent by this call. Not
134
+ // "failed" (that would read as "it may have run") and not a reason to retry the same
135
+ // credential. Give it back (a 404 from the api is a normal "already presented / released").
136
+ await giveBack();
137
+ return {
138
+ success: false,
139
+ error: `"${action}" was not carried out: the gateway refused this credential before running ` +
140
+ `anything (${result.error || 'issuance_consumed'}). Nothing was done.`,
141
+ outcome: 'refused_before_dispatch',
142
+ };
131
143
  case ai_identity_1.GATEWAY_ERROR_CODE.CREDENTIAL_INVALID:
132
144
  // The gateway did not accept the presentation. There is no reissue-and-retry here: the
133
145
  // credential was issued for this one dispatch. (No "nothing was done" claim — the client
@@ -1 +1 @@
1
- {"version":3,"file":"delegated-invoke.js","sourceRoot":"","sources":["../../src/core/delegated-invoke.ts"],"names":[],"mappings":";;AAmCA,sCAEC;AA0CD,sDA2CC;AA1HD;;;;;;;;;;;;;;;;GAgBG;AACH,sDAAyD;AAiBzD,iFAAiF;AACjF,SAAgB,aAAa,CAAC,YAAqC;IACjE,OAAO,YAA4B,CAAA;AACrC,CAAC;AAgCD,MAAM,OAAO,GAAG,CAAC,GAAY,EAAU,EAAE,CAAC,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAA;AAE5F;;;;;;;GAOG;AACI,KAAK,UAAU,qBAAqB,CACzC,IAAyB,EACzB,GAAkB,EAClB,MAAc,EACd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CAAiC,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,SAAS,sBAAsB;gBACxG,OAAO,EAAE,yBAAyB;aACnC,CAAA;QACH,KAAK,kCAAiB,CAAC,iBAAiB;YACtC,2FAA2F;YAC3F,qFAAqF;YACrF,4FAA4F;YAC5F,MAAM,QAAQ,EAAE,CAAA;YAChB,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,KAAK,EACH,IAAI,MAAM,4EAA4E;oBACtF,aAAa,MAAM,CAAC,KAAK,IAAI,mBAAmB,sBAAsB;gBACxE,OAAO,EAAE,yBAAyB;aACnC,CAAA;QACH,KAAK,gCAAkB,CAAC,kBAAkB;YACxC,uFAAuF;YACvF,yFAAyF;YACzF,uDAAuD;YACvD,MAAM,QAAQ,EAAE,CAAA;YAChB,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,IAAI,MAAM,+DAA+D,MAAM,CAAC,KAAK,IAAI,MAAM,CAAC,SAAS,IAAI;gBACpH,OAAO,EAAE,yBAAyB;aACnC,CAAA;QACH;YACE,MAAK;IACT,CAAC;IAED,IAAI,MAAM,CAAC,QAAQ,EAAE,WAAW,KAAK,IAAI,EAAE,CAAC;QAC1C,6FAA6F;QAC7F,0DAA0D;QAC1D,MAAM,QAAQ,CAAC,IAAI,CAAC,CAAA;IACtB,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,CAAA;AACtF,CAAC"}
@@ -106,6 +106,13 @@ export declare class ExecutionEngine {
106
106
  * This is the single entry point for all adapters (MCP, future IDE, SDK).
107
107
  */
108
108
  execute(request: ExecuteRequest): Promise<ExecuteResult>;
109
+ /**
110
+ * Read the outcome of an earlier call that returned `pending` / `in_flight` (two-stage delivery,
111
+ * `aidentity_get_result`). 🔴 Read-only: it takes only the request id and never issues, presents or
112
+ * executes anything — a "get result" cannot be used to trigger an execution.
113
+ * Same mapping as remote-mcp's `PendingResultDelivery.fetch`.
114
+ */
115
+ getResult(requestId: string): Promise<ExecuteResult>;
109
116
  /**
110
117
  * Ensure a valid VC exists for the requested action.
111
118
  * Follows the 4-step acquisition flow from spec §6.1:
@@ -151,7 +158,42 @@ export declare class ExecutionEngine {
151
158
  * 4. Local policy does not deny
152
159
  */
153
160
  private executeLocalOffline;
161
+ /**
162
+ * The gateway (SaaS) arm on the approval mechanism (plan B, PR B1). Same shape as remote-mcp's
163
+ * `callTool` (`remote-mcp/src/server/mcp-tools.service.ts`):
164
+ * 1. ask the issuer (`delegatedInvoke`) — the LLM input is sent HERE and nowhere else;
165
+ * 2. `ask` → wait for the owner for what is left of the call budget (at most 20 s);
166
+ * `approved` → ask again NAMING that approval, execute what comes back;
167
+ * not decided in time → `pending` + `request_id` (read later with `aidentity_get_result`);
168
+ * 3. `allow` → present the credential and call the PEP with `allow.actionParams` only
169
+ * (`executeWithCredential`; `FrozenParams` makes the LLM input unpassable).
170
+ * 🔴 No legacy endpoint is reached from here: no wallet VC, no auto-issue / claim / OOB request /
171
+ * resource resolution, no in-band approval token. Only the issuer raises approval requests.
172
+ */
154
173
  private executeViaGateway;
174
+ /**
175
+ * Ask the issuer. 🔴 The only place the LLM input reaches the api on the gateway arm.
176
+ * `approvalId` = "execute THIS approval"; absent on an LLM call (a question is raised if needed).
177
+ */
178
+ private askIssuer;
179
+ /** Map every non-`ask` issuer answer (remote-mcp `settle`). `allow` executes. */
180
+ private settle;
181
+ /** A refused legacy hand-off (`approval` / `pendingRequestId`) — visible in the audit log. */
182
+ private auditHandoffRefused;
183
+ /** One audit entry for a call that ended without execution on the delegated arm. */
184
+ private auditNotExecuted;
185
+ /** Present the credential and call the PEP with the issuer's arguments (`FrozenParams`). */
186
+ private executeDelegated;
187
+ /** The issuer refused (403 = the owner's settings forbid it: terminal) or could not be reached. */
188
+ private issuerFailure;
189
+ /**
190
+ * The owner has not answered within this call. 🔴 Say "wait, then read the result" only — never
191
+ * "call again once approved": an approved call is executed with the frozen arguments, and a resend
192
+ * whose arguments differ by one character is a different question.
193
+ */
194
+ private deferred;
195
+ /** The same call is being executed (approved; the holder is running it). */
196
+ private inFlight;
155
197
  private executeViaGatewayWithVC;
156
198
  /**
157
199
  * Handle a re-invocation with pendingRequestId (OOB approval polling).