Repository navigation
refactor(runtime): source the VFS transport from @relayfile/adapter-core #179
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -50,6 +50,7 @@ | |||||||||||||||||||
| }, | ||||||||||||||||||||
| "dependencies": { | ||||||||||||||||||||
| "@agent-assistant/proactive": "^0.4.32", | ||||||||||||||||||||
| "@agentworkforce/persona-kit": "workspace:*" | ||||||||||||||||||||
| "@agentworkforce/persona-kit": "workspace:*", | ||||||||||||||||||||
| "@relayfile/adapter-core": "^0.3.29" | ||||||||||||||||||||
| } | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
Comment on lines
+54
to
56
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Adding Prompt for AI agents
Suggested change
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as the gemini thread above — declining.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the feedback! I've saved this as a new learning to improve future reviews. |
||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
| @@ -1,7 +1,12 @@ | ||||||||
| // Shared VFS-backed transport surface. All provider interactions go through | ||||||||
| // these helpers — no per-provider client code lives in the runtime. Handlers | ||||||||
| // and custom clients import these directly instead of recreating the | ||||||||
| // path-validation + receipt-polling logic. | ||||||||
| // these helpers — no per-provider client code lives in the runtime. | ||||||||
| // | ||||||||
| // The transport itself now lives in the relayfile layer | ||||||||
| // (`@relayfile/adapter-core/vfs-client`) — it's the generic Relayfile | ||||||||
| // draft-write protocol, not anything workforce-specific. The runtime re-exports | ||||||||
| // it so existing handlers that `import … from '@agentworkforce/runtime/clients'` | ||||||||
| // keep working unchanged. The ergonomic per-provider clients live in | ||||||||
| // `@relayfile/relay-helpers`. | ||||||||
| export { | ||||||||
| draftFile, | ||||||||
| encodeSegment, | ||||||||
|
|
@@ -11,9 +16,15 @@ export { | |||||||
| readTextFile, | ||||||||
| resolveMountRoot, | ||||||||
| writeJsonFile, | ||||||||
| RelayfileWritebackError, | ||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To ensure the public API is complete and fully backward-compatible, consider exporting
Suggested change
|
||||||||
| type RelayfileWritebackErrorOptions, | ||||||||
| type IntegrationClientOptions, | ||||||||
| type WritebackReceipt, | ||||||||
| type WritebackResult | ||||||||
| } from './request.js'; | ||||||||
| } from '@relayfile/adapter-core/vfs-client'; | ||||||||
|
|
||||||||
| export { WorkforceIntegrationError, SandboxNotAvailableError } from '../errors.js'; | ||||||||
| export { | ||||||||
| WorkforceIntegrationError, | ||||||||
| type WorkforceIntegrationErrorOptions, | ||||||||
| SandboxNotAvailableError | ||||||||
| } from '../errors.js'; | ||||||||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,44 +1,18 @@ | ||
| /** | ||
| * Error type every integration client throws when a remote write or read | ||
| * fails. Lives at the package root rather than inside `clients/` so the | ||
| * persona's handler can `import { WorkforceIntegrationError }` without | ||
| * reaching into a subpath that may evolve. | ||
| * | ||
| * The error carries enough metadata for the runtime's retry layer to | ||
| * make decisions without parsing message strings: | ||
| * | ||
| * - `provider` — `github` / `linear` / `slack` / … | ||
| * - `operation` — the client method that failed (`comment`, | ||
| * `upsertIssue.create`, …) | ||
| * - `retryable` — `true` for transient failures (the runtime resends | ||
| * the originating event); `false` for permanent shape/validation | ||
| * failures that won't change on retry | ||
| * - `cause` — the original thrown value, preserved for logs | ||
| * Error every integration read/write throws on failure. The class now lives | ||
| * with the transport in `@relayfile/adapter-core/vfs-client` as | ||
| * `RelayfileWritebackError`; `WorkforceIntegrationError` is kept as an **alias | ||
| * of the same class** (not a subclass) so existing handlers that | ||
| * `catch (e) { if (e instanceof WorkforceIntegrationError) … }` still match | ||
| * what the relocated transport throws. Same `{ provider, operation, cause, | ||
| * retryable }` shape. | ||
| */ | ||
| export interface WorkforceIntegrationErrorOptions { | ||
| provider: string; | ||
| operation: string; | ||
| cause?: unknown; | ||
| retryable?: boolean; | ||
| } | ||
|
|
||
| export class WorkforceIntegrationError extends Error { | ||
| readonly provider: string; | ||
| readonly operation: string; | ||
| override readonly cause?: unknown; | ||
| readonly retryable: boolean; | ||
|
|
||
| constructor(options: WorkforceIntegrationErrorOptions) { | ||
| super(`${options.provider}.${options.operation} failed${ | ||
| options.cause instanceof Error ? `: ${options.cause.message}` : '' | ||
| }`); | ||
| this.name = 'WorkforceIntegrationError'; | ||
| this.provider = options.provider; | ||
| this.operation = options.operation; | ||
| if (options.cause !== undefined) this.cause = options.cause; | ||
| this.retryable = options.retryable ?? false; | ||
| } | ||
| } | ||
| export { | ||
| RelayfileWritebackError, | ||
| RelayfileWritebackError as WorkforceIntegrationError, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P2: Aliasing Prompt for AI agents
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Intentional, declining. The alias keeps
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the feedback! I've saved this as a new learning to improve future reviews. |
||
| type RelayfileWritebackErrorOptions, | ||
| type RelayfileWritebackErrorOptions as WorkforceIntegrationErrorOptions | ||
| } from '@relayfile/adapter-core/vfs-client'; | ||
|
|
||
| /** | ||
| * Thrown when handler code calls `ctx.sandbox.exec()` on a persona that | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -60,7 +60,10 @@ export { | |||||||||
| type IntegrationClientOptions, | ||||||||||
| type WritebackReceipt, | ||||||||||
| type WritebackResult, | ||||||||||
| RelayfileWritebackError, | ||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To expose the error option types in the main entry point of the package, consider re-exporting
Suggested change
|
||||||||||
| type RelayfileWritebackErrorOptions, | ||||||||||
| WorkforceIntegrationError, | ||||||||||
| type WorkforceIntegrationErrorOptions, | ||||||||||
| SandboxNotAvailableError | ||||||||||
| } from './clients/index.js'; | ||||||||||
|
|
||||||||||
|
|
||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since
@relayfile/adapter-corehas a peer dependency on@relayfile/sdk(>=0.6.0 <1), consumers of@agentworkforce/runtimemay encounter peer dependency resolution warnings during installation if@relayfile/sdkis not explicitly declared.Consider adding
@relayfile/sdkto thepeerDependenciesof@agentworkforce/runtimeto ensure clean installations:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Declining this one:
@relayfile/adapter-core/vfs-client(the only subpath the runtime imports) doesn't import@relayfile/sdkat all,@relayfile/sdkisn't resolvable in the workforce tree, and the sibling consumer@agentworkforce/persona-kit(which also depends on adapter-core) doesn't declare it either — yet everything builds and tests green. Adding it as a peer would impose an unused, uninstalled dependency on every runtime consumer and diverge from the repo's existing convention. The unmet peer is adapter-core's to resolve (ideallypeerDependenciesMeta.optionalthere) rather than something each consumer re-declares.