@ampcode/plugin 0.0.0-20260920001948-g88e99e8 → 0.0.0-20260922001754-ga9ffbd3
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/index.d.ts +78 -1
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -129,6 +129,24 @@ declare module '@ampcode/plugin' {
|
|
|
129
129
|
*/
|
|
130
130
|
registerSkill(definition: PluginSkillDefinition): Promise<Subscription>
|
|
131
131
|
|
|
132
|
+
/**
|
|
133
|
+
* Register a text pattern that Amp turns into a link wherever it appears in a thread
|
|
134
|
+
* transcript: user messages and the prose of assistant replies.
|
|
135
|
+
*
|
|
136
|
+
* Amp records the patterns on each thread this plugin's executor connects to, so readers
|
|
137
|
+
* who open the thread later without an executor still see the links.
|
|
138
|
+
*
|
|
139
|
+
* @example
|
|
140
|
+
* ```ts
|
|
141
|
+
* amp.registerLinkPattern({
|
|
142
|
+
* id: 'issue',
|
|
143
|
+
* pattern: 'ENG-\\d{1,6}',
|
|
144
|
+
* href: 'https://linear.app/acme/issue/{{match}}',
|
|
145
|
+
* })
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
148
|
+
registerLinkPattern(definition: PluginLinkPatternDefinition): Subscription
|
|
149
|
+
|
|
132
150
|
/**
|
|
133
151
|
* Register a callback that runs before this plugin instance is stopped.
|
|
134
152
|
*
|
|
@@ -1299,7 +1317,7 @@ declare module '@ampcode/plugin' {
|
|
|
1299
1317
|
confirmButtonText?: string
|
|
1300
1318
|
}
|
|
1301
1319
|
|
|
1302
|
-
/** An editable
|
|
1320
|
+
/** An editable text field in a confirmation dialog. */
|
|
1303
1321
|
export interface PluginConfirmField {
|
|
1304
1322
|
/** Stable key used in the returned record */
|
|
1305
1323
|
name: string
|
|
@@ -1312,6 +1330,9 @@ declare module '@ampcode/plugin' {
|
|
|
1312
1330
|
|
|
1313
1331
|
/** Allow the field to span multiple lines */
|
|
1314
1332
|
multiline?: boolean
|
|
1333
|
+
|
|
1334
|
+
/** Allow the field to be left empty. Fields are required unless this is set. */
|
|
1335
|
+
optional?: boolean
|
|
1315
1336
|
}
|
|
1316
1337
|
|
|
1317
1338
|
/** Options for a confirmation dialog that returns edited field values. */
|
|
@@ -1541,6 +1562,14 @@ declare module '@ampcode/plugin' {
|
|
|
1541
1562
|
|
|
1542
1563
|
/** The message ID */
|
|
1543
1564
|
id: ThreadMessageID
|
|
1565
|
+
|
|
1566
|
+
/**
|
|
1567
|
+
* Set when a client's canned changes workflow started this turn: `ship` for the Ship
|
|
1568
|
+
* button and `push_branch` for Push to Branch. Absent for prompts the user typed.
|
|
1569
|
+
* Use it to append workflow-specific instructions (for example, issue-tracker follow-up
|
|
1570
|
+
* after shipping) instead of matching on the prompt text.
|
|
1571
|
+
*/
|
|
1572
|
+
changesWorkflow?: 'ship' | 'push_branch'
|
|
1544
1573
|
}
|
|
1545
1574
|
|
|
1546
1575
|
/**
|
|
@@ -1594,6 +1623,52 @@ declare module '@ampcode/plugin' {
|
|
|
1594
1623
|
maxContinuations?: number
|
|
1595
1624
|
} | void
|
|
1596
1625
|
|
|
1626
|
+
/**
|
|
1627
|
+
* Event payload for changes.prompt event.
|
|
1628
|
+
* Fired when a client prepares the prompt behind its Ship or Push to Branch button, before
|
|
1629
|
+
* the user sees it. The Ship dialog shows the assembled prompt, so the user can edit anything a
|
|
1630
|
+
* plugin adds before sending.
|
|
1631
|
+
*/
|
|
1632
|
+
export interface ChangesPromptEvent {
|
|
1633
|
+
/** The thread whose changes are about to be shipped or pushed */
|
|
1634
|
+
thread: { id: ThreadID }
|
|
1635
|
+
|
|
1636
|
+
/** `ship` for the Ship button, `push_branch` for Push to Branch */
|
|
1637
|
+
workflow: 'ship' | 'push_branch'
|
|
1638
|
+
}
|
|
1639
|
+
|
|
1640
|
+
/**
|
|
1641
|
+
* Result returned from a changes.prompt handler.
|
|
1642
|
+
* Return `append` to add instructions after the prompt, such as issue-tracker follow-up steps
|
|
1643
|
+
* for the shipped commits. Every plugin's `append` is added, in plugin load order.
|
|
1644
|
+
*/
|
|
1645
|
+
export type ChangesPromptResult = { append?: string } | void
|
|
1646
|
+
|
|
1647
|
+
/**
|
|
1648
|
+
* A text pattern that Amp turns into a link in thread transcripts.
|
|
1649
|
+
* See {@link PluginAPI.registerLinkPattern}.
|
|
1650
|
+
*/
|
|
1651
|
+
export interface PluginLinkPatternDefinition {
|
|
1652
|
+
/** Stable identifier within this plugin, such as `issue`. Letters, digits, and hyphens; up to 64 characters. */
|
|
1653
|
+
id: string
|
|
1654
|
+
|
|
1655
|
+
/**
|
|
1656
|
+
* Regular expression source that matches one token, such as `ENG-\d{1,6}`, written
|
|
1657
|
+
* without anchors, flags, or delimiters. Amp compiles it with the `u` flag, requires a
|
|
1658
|
+
* token boundary on both sides, and limits it to 200 characters. Backreferences and
|
|
1659
|
+
* lookbehind are rejected, as is a pattern that matches the empty string. Named capture
|
|
1660
|
+
* groups can be used in `href`.
|
|
1661
|
+
*/
|
|
1662
|
+
pattern: string
|
|
1663
|
+
|
|
1664
|
+
/**
|
|
1665
|
+
* URL template for the link. `{{match}}` is replaced with the whole match and
|
|
1666
|
+
* `{{name}}` with the named capture group `name`, both URL-encoded. The result must be an
|
|
1667
|
+
* `http:` or `https:` URL, or an absolute path on Amp such as `/admin/bug-reports/{{match}}`.
|
|
1668
|
+
*/
|
|
1669
|
+
href: string
|
|
1670
|
+
}
|
|
1671
|
+
|
|
1597
1672
|
/**
|
|
1598
1673
|
* Map of event names to their payload types.
|
|
1599
1674
|
*/
|
|
@@ -1603,6 +1678,7 @@ declare module '@ampcode/plugin' {
|
|
|
1603
1678
|
'tool.result': ToolResultEvent
|
|
1604
1679
|
'agent.start': AgentStartEvent
|
|
1605
1680
|
'agent.end': AgentEndEvent
|
|
1681
|
+
'changes.prompt': ChangesPromptEvent
|
|
1606
1682
|
}
|
|
1607
1683
|
|
|
1608
1684
|
/**
|
|
@@ -1614,6 +1690,7 @@ declare module '@ampcode/plugin' {
|
|
|
1614
1690
|
'tool.result': ToolResultResult
|
|
1615
1691
|
'agent.start': AgentStartResult
|
|
1616
1692
|
'agent.end': AgentEndResult
|
|
1693
|
+
'changes.prompt': ChangesPromptResult
|
|
1617
1694
|
}
|
|
1618
1695
|
|
|
1619
1696
|
/**
|