fix(plugin-types): ActionsAPI.register handler exec-context d.ts (fn-176.1) - #5
Merged
Conversation
…ontext, not raw input (fn-176.1)
The host invokes action handlers with a single exec-context object
({ invocationId, source, input, sourceId? } — PluginActionsBridge.swift),
but the d.ts declared the handler as (input: AnyJSONValue). Known drift F1.
- Export InvocationSource (host-canonical 6-member literal union) and
ActionExecutionContext (exact host field set, no index signature) from
namespaces-core-plugins.ts; register's handler param is now
(exec: ActionExecutionContext); return type and def param unchanged;
JSDoc updated to describe exec-context dispatch.
- index.ts header + README: drop the '/// <reference types=...>' global
usage suggestion (package ships module exports only — it produced
TS2304); import-based guidance only.
- New compile-only typetest src/__tests__/actions.typetest.ts importing
via the public entrypoint (../index): cases (a)-(e) per fn-176.1.
Probe outcomes (TS 5.x, recorded in-file):
* (a) compiles with a type-alias SomeShape; an interface target fails
'exec.input as X' (no implicit index signature) — ytdlp's unmodified
interface DownloadUrlInput still needs interface→type or
'as unknown as' (flagged to fn-176.3).
* (f) legacy (input: AnyJSONValue) handler does NOT assign
(ActionExecutionContext has no index signature) — case dropped per
task fallback rule; changelog language for .3:
source-breaking-but-runtime-correcting.
- tsconfig.json: exclude docs-site from root lint project — root
'npm run lint' has been red since PR #4 (docs-site's astro:content
virtual module + its node_modules get swept); docs-site has its own
toolchain and CI.
- package-lock.json: 1-line sync of the plugin-types workspace stanza
to the pre-staged 3.0.0.
Validation: npm run build RC=0; npm test RC=0 (typetest enforced —
unused @ts-expect-error fails compile); npm run lint RC=0; dist
verification: dist surface exports ActionExecutionContext via package
entrypoint (probe RC=0), zero 'handler: (input: AnyJSONValue)' in dist;
grep gates: zero '/// <reference types="@appos.space/plugin-types"',
zero stale handler shape; notifications.emit(input:) untouched.
Task: fn-176-sdk-fix-actionsapiregister-handler-dts.1
…g, 3.0.x example (fn-176.1 review r1) Codex impl-review round 1 Minor: README still mapped 2.4.x <-> plugin API 2.4.x while the package ships 3.0.0. Phrase the mapping version-agnostically so it survives future bumps (incl. a potential 3.0.1 under the epic's release fallback rule). Task: fn-176-sdk-fix-actionsapiregister-handler-dts.1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes known d.ts drift F1:
ActionsAPI.registerdeclared its handler as(input: AnyJSONValue) => ..., but the host invokes handlers with a single exec-context object —{ invocationId, source, input, sourceId? }(host truth: AppOS-DesktopPluginActionsBridge.swift:1332-1348; host's ownplugin-api.d.tsalready agrees).Flow tracking: fn-176.1 (epic
fn-176-sdk-fix-actionsapiregister-handler-dts, AppOS-Desktop.flow/).Changes
namespaces-core-plugins.ts— exportInvocationSource("user" | "plugin" | "agent" | "recipe" | "sequence" | "system") andActionExecutionContext(invocationId: string; source: InvocationSource; input: AnyJSONValue; sourceId?: string, no index signature);register's handler param is now(exec: ActionExecutionContext); return type anddefparam unchanged; JSDoc describes exec-context dispatch.notifications.emit(input: AnyJSONValue)untouched (genuine input param).src/index.tsheader andREADME.mddrop the/// <reference types="@appos.space/plugin-types" />suggestion (package ships module exports only — no ambient globals); import-only guidance remains. README version mapping made version-agnostic (review r1).src/__tests__/actions.typetest.tsimporting via the public entrypoint (../index): (a) ytdlp's(exec) => exec.input as SomeShapepattern withdisplayName/risk/tagsdef extras; (b) field reads; (c)@ts-expect-errorundeclared prop; (d)@ts-expect-errorincompatible handler param; (e)@ts-expect-errornon-membersourceliteral comparison.tsconfig.json— excludedocs-sitefrom the root lint project (rootnpm run linthas been red since PR feat: automated developer docs site (TypeDoc + Starlight + CI) #4: Astro'sastro:contentvirtual module + docs-sitenode_modulesget swept; docs-site has its own toolchain/CI).package-lock.json— 1-line sync of the plugin-types workspace stanza to the pre-staged3.0.0.Empirical probe outcomes (recorded in the typetest, flagged to fn-176.3 release task)
(input: AnyJSONValue)handler does NOT assign (TS2345 — interfaces get no implicit index signature, soActionExecutionContextis not assignable toAnyJSONValue's object arm). Changelog language for the release: source-breaking-but-runtime-correcting. Untyped(input) => ...handlers keep compiling at the call site.exec.input as SomeInterfacefails TS2352 (same TS rule); atype-alias target compiles. Real-ytdlp evidence: fulltsc --noEmitagainst this build yields exactly one error (TS2352 atregister-actions.ts:216, itsinterface DownloadUrlInput) — the original F1 error ("Property 'input' does not exist") is gone. Counterfactualinput: unknown(host-d.ts parity) compiles ytdlp clean; the spec's R1 choseAnyJSONValue— decision deferred to the release task / ytdlp workstream (1-lineinterface→typeon their side also resolves it).Evidence
npm run buildRC=0 ·npm testRC=0 (typetest enforced — unused@ts-expect-errorfails compile) · rootnpm run lintRC=0dist/namespaces-core-plugins.d.tscontainsActionExecutionContext(re-exported viadist/index.d.tsexport *; package-name import probe resolves RC=0); zerohandler: (input: AnyJSONValue)indist//// <reference types="@appos.space/plugin-types"and zero stale handler shape repo-wide (node_modules excluded)Not in this PR
./release.sh, occupancy-guarded 3.0.0-vs-3.0.1 decision).