@agimon-ai/po-goal 0.0.0-alpha.13 → 0.0.0-alpha.131

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/LICENSE CHANGED
@@ -1,21 +1,149 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Vuong Ngo
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ License text copyright © 2017 MariaDB Corporation Ab, All Rights Reserved.
2
+ "Business Source License" is a trademark of MariaDB Corporation Ab.
3
+
4
+ Parameters
5
+
6
+ Licensor: Agimon Pty Ltd
7
+ Licensed Work: Po, the software in the Po source repository and the
8
+ packages released from it, in each version released by
9
+ the Licensor.
10
+ The Licensed Work is (c) 2026 Agimon Pty Ltd.
11
+ Material identified as third-party in the "Third-party
12
+ components" section at the end of this file or in a
13
+ NOTICE file, and any package or directory whose own
14
+ license file grants a different license, is not part of
15
+ the Licensed Work and remains under its own license.
16
+ Additional Use Grant: You may make production use of the Licensed Work if
17
+ your use is Eligible Use. "Eligible Use" is production use that falls
18
+ within at least one of the following:
19
+
20
+ (a) Personal Use. Use by an individual for their own personal purposes,
21
+ and not on behalf of, or for the benefit of, an employer, client, or
22
+ other Organization. Use by an individual in the course of employment
23
+ or engagement by an Organization is use by that Organization.
24
+
25
+ (b) Small Organization Use. Use by or on behalf of an Organization whose
26
+ Annual Revenue is less than USD 1,000,000.
27
+
28
+ (c) Non-profit, Education and Research Use. Use, regardless of Annual
29
+ Revenue, by (i) an Organization registered or recognized as a
30
+ non-profit or charitable organization under the laws of its
31
+ jurisdiction, for its non-profit purposes; (ii) an accredited school,
32
+ college, or university, for teaching, learning, or academic research;
33
+ or (iii) a publicly funded research institution, for its research.
34
+
35
+ (d) Service Provider Use. Use by a consultant, contractor, agency, or other
36
+ service provider, regardless of its own Annual Revenue, solely to
37
+ build, deploy, host, operate, or support the Licensed Work for a client
38
+ whose own use would be Eligible Use under (a), (b), or (c). A service
39
+ provider's use for its own purposes is Eligible Use only if the service
40
+ provider itself qualifies under (b) or (c).
41
+
42
+
43
+ Hosted services. Offering the Licensed Work to third parties as a hosted
44
+ or managed service whose primary value is the Licensed Work is Eligible
45
+ Use only if each such third party's own use would be Eligible Use.
46
+
47
+ Definitions. "Organization" means any company, partnership, sole
48
+ proprietorship, trust, association, government body, or other entity, and
49
+ includes an individual acting in a business or professional capacity.
50
+ "Affiliate" means any entity that directly or indirectly controls, is
51
+ controlled by, or is under common control with an Organization, where
52
+ "control" means ownership of more than 50% of the voting interests of an
53
+ entity or the power to direct its management and policies by contract or
54
+ otherwise. "Annual Revenue" means the total gross revenue of an
55
+ Organization and all of its Affiliates combined, from all sources and
56
+ whether or not related to the Licensed Work, for its most recently
57
+ completed fiscal year, or, if it has not completed a fiscal year, for the
58
+ twelve months before the use (or since its formation, if shorter),
59
+ converted into US dollars at the average exchange rate for that period.
60
+ Proceeds of equity or debt financing are not revenue.
61
+
62
+ Threshold. If an Organization stops qualifying under (b), its existing
63
+ production use remains Eligible Use for 90 days after it stops
64
+ qualifying, after which it must obtain a commercial license or stop
65
+ production use. Use that was Eligible Use when it occurred never requires
66
+ a commercial license after the fact.
67
+ Change Date: Four years from the date a version of the Licensed Work
68
+ is first publicly released by the Licensor.
69
+ Change License: Apache License, Version 2.0
70
+
71
+ For information about alternative licensing arrangements for the Licensed
72
+ Work, please visit: https://agimon.ai/licensing
73
+
74
+ Notice
75
+
76
+ The Business Source License (this document, or the "License") is not an Open
77
+ Source license. However, the Licensed Work will eventually be made available
78
+ under an Open Source License, as stated in this License.
79
+
80
+ -----------------------------------------------------------------------------
81
+
82
+ Business Source License 1.1
83
+
84
+ Terms
85
+
86
+ The Licensor hereby grants you the right to copy, modify, create derivative
87
+ works, redistribute, and make non-production use of the Licensed Work. The
88
+ Licensor may make an Additional Use Grant, above, permitting limited
89
+ production use.
90
+
91
+ Effective on the Change Date, or the fourth anniversary of the first publicly
92
+ available distribution of a specific version of the Licensed Work under this
93
+ License, whichever comes first, the Licensor hereby grants you rights under
94
+ the terms of the Change License, and the rights granted in the paragraph
95
+ above terminate.
96
+
97
+ If your use of the Licensed Work does not comply with the requirements
98
+ currently in effect as described in this License, you must purchase a
99
+ commercial license from the Licensor, its affiliated entities, or authorized
100
+ resellers, or you must refrain from using the Licensed Work.
101
+
102
+ All copies of the original and modified Licensed Work, and derivative works
103
+ of the Licensed Work, are subject to this License. This License applies
104
+ separately for each version of the Licensed Work and the Change Date may vary
105
+ for each version of the Licensed Work released by Licensor.
106
+
107
+ You must conspicuously display this License on each original or modified copy
108
+ of the Licensed Work. If you receive the Licensed Work in original or
109
+ modified form from a third party, the terms and conditions set forth in this
110
+ License apply to your use of that work.
111
+
112
+ Any use of the Licensed Work in violation of this License will automatically
113
+ terminate your rights under this License for the current and all other
114
+ versions of the Licensed Work.
115
+
116
+ This License does not grant you any right in any trademark or logo of
117
+ Licensor or its affiliates (provided that you may use a trademark or logo of
118
+ Licensor as expressly required by this License).
119
+
120
+ TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
121
+ AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
122
+ EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
123
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
124
+ TITLE.
125
+
126
+ MariaDB hereby grants you permission to use this License’s text to license
127
+ your works, and to refer to it using the trademark “Business Source License”,
128
+ as long as you comply with the Covenants of Licensor below.
129
+
130
+ Covenants of Licensor
131
+
132
+ In consideration of the right to use this License’s text and the “Business
133
+ Source License” name and trademark, Licensor covenants to MariaDB, and to all
134
+ other recipients of the licensed work to be provided by Licensor:
135
+
136
+ 1. To specify as the Change License the GPL Version 2.0 or any later version,
137
+ or a license that is compatible with GPL Version 2.0 or a later version,
138
+ where “compatible” means that software provided under the Change License can
139
+ be included in a program with software provided under GPL Version 2.0 or a
140
+ later version. Licensor may specify additional Change Licenses without
141
+ limitation.
142
+
143
+ 2. To either: (a) specify an additional grant of rights to use that does not
144
+ impose any additional restriction on the right granted in this License, as
145
+ the Additional Use Grant; or (b) insert the text “None”.
146
+
147
+ 3. To specify a Change Date.
148
+
149
+ 4. Not to modify this License in any other way.
package/README.md CHANGED
@@ -94,7 +94,7 @@ Maintained by [Agimon](https://agimon.ai/about).
94
94
 
95
95
  ## License
96
96
 
97
- MIT
97
+ Business Source License 1.1: free for personal use, organisations under USD 1M revenue, non-profits and education. See [LICENSE](LICENSE) and https://agimon.ai/licensing.
98
98
 
99
99
  Plugin entries live in `src/extensions`, with host-neutral runtime logic in `src/services` and host registrations in routed `src/extensions` surfaces. `src/models` owns goal state, accounting, transitions, and serialization. Named `src/services` folders handle history, persistence, prompts, and validation. Public helpers and types are exposed through flat `src/exports`.
100
100
 
@@ -3,7 +3,7 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  //#region src/schemas/apiContracts.ts
6
- /** This facet contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */
6
+ /** This server plugin contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */
7
7
  const apiContracts = (0, require("@agimon-ai/po-core/apiContracts").defineApiContract)({
8
8
  version: 1,
9
9
  http: [],
@@ -1 +1 @@
1
- {"version":3,"file":"apiContracts.cjs","names":["defineApiContract"],"sources":["../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract } from '@agimon-ai/po-core/apiContracts';\n\n/** This facet contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */\nexport const apiContracts = defineApiContract({ version: 1, http: [], sockets: [], dynamic: [] });\nexport default apiContracts;\n"],"mappings":";;;;;;AAGA,MAAa,gBAAA,4CAAeA,CAAAA,CAAAA,kBAAAA,CAAkB;CAAE,SAAS;CAAG,MAAM,CAAC;CAAG,SAAS,CAAC;CAAG,SAAS,CAAC;AAAE,CAAC"}
1
+ {"version":3,"file":"apiContracts.cjs","names":["defineApiContract"],"sources":["../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract } from '@agimon-ai/po-core/apiContracts';\n\n/** This server plugin contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */\nexport const apiContracts = defineApiContract({ version: 1, http: [], sockets: [], dynamic: [] });\nexport default apiContracts;\n"],"mappings":";;;;;;AAGA,MAAa,gBAAA,G,yCAAeA,CAAAA,CAAAA,kBAAAA,CAAkB;CAAE,SAAS;CAAG,MAAM,CAAC;CAAG,SAAS,CAAC;CAAG,SAAS,CAAC;AAAE,CAAC"}
@@ -1,5 +1,5 @@
1
1
  //#region src/schemas/apiContracts.d.ts
2
- /** This facet contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */
2
+ /** This server plugin contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */
3
3
  export declare const apiContracts: {
4
4
  version: 1;
5
5
  protocols?: Record<string, string> | undefined;
@@ -1,6 +1,6 @@
1
1
  import { defineApiContract } from "@agimon-ai/po-core/apiContracts";
2
2
  //#region src/schemas/apiContracts.ts
3
- /** This facet contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */
3
+ /** This server plugin contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */
4
4
  const apiContracts = defineApiContract({
5
5
  version: 1,
6
6
  http: [],
@@ -1 +1 @@
1
- {"version":3,"file":"apiContracts.mjs","names":[],"sources":["../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract } from '@agimon-ai/po-core/apiContracts';\n\n/** This facet contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */\nexport const apiContracts = defineApiContract({ version: 1, http: [], sockets: [], dynamic: [] });\nexport default apiContracts;\n"],"mappings":";;;AAGA,MAAa,eAAe,kBAAkB;CAAE,SAAS;CAAG,MAAM,CAAC;CAAG,SAAS,CAAC;CAAG,SAAS,CAAC;AAAE,CAAC"}
1
+ {"version":3,"file":"apiContracts.mjs","names":[],"sources":["../src/schemas/apiContracts.ts"],"sourcesContent":["import { defineApiContract } from '@agimon-ai/po-core/apiContracts';\n\n/** This server plugin contributes agent tools, commands or lifecycle only, with no separate HTTP or socket surface. */\nexport const apiContracts = defineApiContract({ version: 1, http: [], sockets: [], dynamic: [] });\nexport default apiContracts;\n"],"mappings":";;;AAGA,MAAa,eAAe,kBAAkB;CAAE,SAAS;CAAG,MAAM,CAAC;CAAG,SAAS,CAAC;CAAG,SAAS,CAAC;AAAE,CAAC"}
@@ -267,6 +267,29 @@ const styles = StyleSheet.create((theme) => ({
267
267
  //#region src/extensions/workspaces/sessions/(frontend)/fill/Goal.activity.goal.native.tsx
268
268
  var Goal_activity_goal_native_default = defineFill({ component: GoalActivitySection });
269
269
  //#endregion
270
+ //#region src/extensions/workspaces/sessions/(frontend)/fill/Goal.help.guides.native.ts
271
+ var Goal_help_guides_native_default = defineFill({
272
+ slot: "help.guides",
273
+ id: "Goal",
274
+ order: 30,
275
+ data: {
276
+ version: 1,
277
+ label: "Goal",
278
+ guides: [{
279
+ id: "about",
280
+ question: "What is a goal?",
281
+ order: 0,
282
+ answer: "A goal keeps one objective active across agent turns. An independent check reviews the transcript and verification evidence when the session is idle."
283
+ }, {
284
+ id: "budget",
285
+ question: "How do I set a goal or token budget?",
286
+ order: 1,
287
+ answer: "Send /goal followed by your objective. For a budget, use /goal --tokens 100k followed by the objective. Budgets also accept values such as 1.5m.",
288
+ keywords: ["limit", "tokens"]
289
+ }]
290
+ }
291
+ });
292
+ //#endregion
270
293
  //#region generated/native.ts
271
294
  const via = (identity, value) => value === void 0 ? void 0 : {
272
295
  ...identity,
@@ -282,7 +305,10 @@ const nativePlugin = defineNativePlugin({
282
305
  return [via({
283
306
  slot: "activity.goal",
284
307
  id: "goal"
285
- }, Goal_activity_goal_native_default)];
308
+ }, Goal_activity_goal_native_default), via({
309
+ slot: "help.guides",
310
+ id: "goal"
311
+ }, Goal_help_guides_native_default)];
286
312
  }
287
313
  }
288
314
  });
@@ -1 +1 @@
1
- {"version":3,"file":"native.mjs","names":["WebPluginSlotProps","Button","DropdownMenu","DropdownMenuTrigger","DropdownMenuContent","DropdownMenuItem","KebabIcon","Input","Label","ListRow","Sheet","SheetContent","SheetHeader","SheetTitle","SheetBody","Textarea","fontOf","PoNativeTheme","useState","StyleSheet","GOAL_VIEW_STATUS_KEY","parseGoalStatusView","budgetHintOf","CLEAR_GOAL_COMMAND","editGoalCommand","GoalSheet","objective","state","mode","submit","close","error","command","draft","setDraft","budget","setBudget","open","styles","meta","actions","undefined","value","GoalActivitySection","sessionId","statuses","sendSessionFrame","setMode","view","setError","title","type","message","failure","Error","String","create","theme","fontFamily","sans","fontSize","base","lineHeight","fontWeight","color","colors","hi","uni__dependencies","flexDirection","justifyContent","gap","spacing","sm","dim","red","activityGroupGoal","fillGoal"],"sources":["../../src/types/goalView.ts","../../src/extensions/workspaces/sessions/(frontend)/activity-group/goal.native.ts","../../src/types/goal.ts","../../src/extensions/workspaces/sessions/(frontend)/fill/_lib/goalCommands.ts","../../src/extensions/workspaces/sessions/(frontend)/fill/_components/GoalActivitySection.native.tsx","../../src/extensions/workspaces/sessions/(frontend)/fill/Goal.activity.goal.native.tsx","../../generated/native.ts"],"sourcesContent":["/**\n * The goal the cockpit shows, as it travels.\n *\n * The session has no data channel of its own, so the objective reaches the\n * browser on a footer status the host already relays and replays to a\n * reattaching page. This module is both halves of that wire format: the session\n * writes it, the activity dock reads it, and neither knows the other.\n */\n\n/** The status key the activity group keys off, distinct from the footer's terse `goal`. */\nexport const GOAL_VIEW_STATUS_KEY = 'po-goal-current';\n\n/**\n * Between the state and the objective.\n *\n * An objective may itself contain this sequence, so the split is on the first\n * occurrence rather than the last: the state is the one leading field and\n * everything after it belongs to the goal.\n */\nconst STATUS_SEPARATOR = ' · ';\n\n/** Strips the colour a session may have themed a status with. */\nconst ANSI = /\u001b\\[[0-9;]*m/gu;\n\n/** What a reader gets out of the status line. */\nexport interface GoalStatusView {\n /** How the session words the goal's state, such as `active 12.4k/100k`. */\n state: string;\n /** The objective, as the goal holds it. */\n objective: string;\n}\n\n/** The status line the session publishes for the dock. */\nexport function formatGoalStatusView(objective: string, state: string): string {\n return `${state}${STATUS_SEPARATOR}${objective}`;\n}\n\n/**\n * Reading the status line back. Statuses reach a plugin raw, so the colour a\n * session may have added comes off here. An absent, empty, or objective-less\n * line means there is no goal to draw a row for.\n */\nexport function parseGoalStatusView(raw: string | undefined): GoalStatusView | undefined {\n if (raw === undefined) return undefined;\n const text = raw.replace(ANSI, '').trim();\n const cut = text.indexOf(STATUS_SEPARATOR);\n if (cut === -1) return undefined;\n const objective = text.slice(cut + STATUS_SEPARATOR.length).trim();\n return objective === '' ? undefined : { state: text.slice(0, cut).trim(), objective };\n}\n","import { defineActivityGroup } from '@agimon-ai/po-core/native';\n\nimport { GOAL_VIEW_STATUS_KEY } from '../../../../../types/goalView';\n\nexport default defineActivityGroup({\n keys: 'g e',\n statusKey: GOAL_VIEW_STATUS_KEY,\n marksBackgroundWork: false,\n hideWhenEmpty: true,\n order: 35,\n});\n","export const GOAL_STATUSES = ['active', 'paused', 'blocked', 'usage_limited', 'budget_limited', 'complete'] as const;\n/**\n * The longest objective a goal may hold. A constraint on the text itself rather\n * than on the command that sets it, so the parser, the codec, and the cockpit's\n * edit form all measure against the same number.\n */\nexport const MAX_OBJECTIVE_LENGTH = 4_000;\nexport type GoalStatus = (typeof GOAL_STATUSES)[number];\nexport type SafetyPauseCause = 'continuation_limit' | 'no_progress';\nexport interface ActiveGoal {\n id: string;\n text: string;\n status: GoalStatus;\n startedAt: number;\n updatedAt: number;\n iteration: number;\n tokenBudget?: number;\n tokensUsed: number;\n timeUsedSeconds: number;\n baselineTokens: number;\n activeStartedAt?: number;\n automaticModelTurns: number;\n toolFreeRepeatCount: number;\n lastToolFreeOutputFingerprint?: string;\n safetyPauseCause?: SafetyPauseCause;\n safetyResetPending?: boolean;\n}\nexport interface GoalStateData {\n goal: ActiveGoal | null;\n}\nexport interface LoadedGoalState {\n goal?: ActiveGoal;\n source: 'none' | 'canonical' | 'legacy-goals';\n malformed: boolean;\n}\nexport type GoalExecutionState = 'dormant' | 'executing' | 'retained';\nexport interface GoalRuntimeSnapshot {\n loaded: boolean;\n execution: GoalExecutionState;\n goal?: ActiveGoal;\n}\n","import { MAX_OBJECTIVE_LENGTH } from '../../../../../../types/goal';\n\n/**\n * The slash commands the goal group sends, built in one place.\n *\n * The cockpit drives the goal through the same `/goal` verbs the terminal does\n * rather than through an API of its own, so an edit made here and an edit typed\n * there are one operation. That makes the shape of the command the contract,\n * and this is where it is kept honest: Pi tokenizes a command on whitespace and\n * rejoins on single spaces, so a multi-line objective typed into a textarea\n * would arrive collapsed. Collapsing it here means what the dialog previews is\n * what the goal ends up holding.\n *\n * One thing this cannot smooth over: Pi's tokenizer also strips quotes, so an\n * objective written with them loses them, exactly as it would if it were typed\n * after /goal in the terminal.\n */\n\nexport const CLEAR_GOAL_COMMAND = '/goal clear';\n\n/** Whitespace as Pi's tokenizer sees it: any run of it separates two tokens. */\nconst WHITESPACE = /\\s+/gu;\n\n/** What the session's parseTokenBudget accepts: a count, optionally in thousands or millions. */\nconst TOKEN_BUDGET = /^\\d+(?:\\.\\d+)?[km]?$/iu;\n\n/**\n * The objective as the goal will hold it, or undefined when there is nothing\n * sendable. Repeated and surrounding whitespace goes the way Pi would take it\n * anyway, and an over-long one is refused here rather than after a round trip.\n */\nexport function normalizeObjective(objective: string): string | undefined {\n const collapsed = objective.trim().replaceAll(WHITESPACE, ' ');\n return collapsed === '' || collapsed.length > MAX_OBJECTIVE_LENGTH ? undefined : collapsed;\n}\n\n/**\n * The `/goal edit` a save sends, or undefined while the form cannot make one.\n *\n * A blank budget omits `--tokens`, which is what leaves the goal's current\n * budget alone: the session writes a budget only when the flag is present.\n */\n/**\n * The budget out of a state line, for the edit form's placeholder.\n *\n * The session words a budgeted goal as `used/budget` and an unbudgeted one\n * without a slash, and it abbreviates both the way `--tokens` reads them back,\n * so the tail of that line is already a value the command accepts.\n */\nexport function budgetHintOf(state: string): string {\n const cut = state.indexOf('/');\n return cut === -1 ? '' : state.slice(cut + 1).trim();\n}\n\nexport function editGoalCommand(objective: string, budget: string): string | undefined {\n const text = normalizeObjective(objective);\n if (text === undefined) return undefined;\n const tokens = budget.trim();\n if (tokens === '') return `/goal edit ${text}`;\n return TOKEN_BUDGET.test(tokens) ? `/goal edit --tokens ${tokens} ${text}` : undefined;\n}\n","import type { WebPluginSlotProps } from '@agimon-ai/po-core/native';\nimport {\n Button,\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItem,\n KebabIcon,\n Input,\n Label,\n ListRow,\n Sheet,\n SheetContent,\n SheetHeader,\n SheetTitle,\n SheetBody,\n Textarea,\n fontOf,\n} from '@agimon-ai/po-native-components';\nimport type { PoNativeTheme } from '@agimon-ai/po-web-components/nativeTheme';\nimport { useState } from 'react';\nimport { Text, View } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport { GOAL_VIEW_STATUS_KEY, parseGoalStatusView } from '../../../../../../types/goalView';\nimport { budgetHintOf, CLEAR_GOAL_COMMAND, editGoalCommand } from '../_lib/goalCommands';\n\nfunction GoalSheet({\n objective,\n state,\n mode,\n submit,\n close,\n error,\n}: {\n objective: string;\n state: string;\n mode: 'edit' | 'confirm';\n submit: (command: string) => void;\n close: () => void;\n error?: string;\n}) {\n const [draft, setDraft] = useState(objective);\n const [budget, setBudget] = useState('');\n const command = editGoalCommand(draft, budget);\n return (\n <Sheet\n open\n onOpenChange={(open) => {\n if (!open) close();\n }}\n >\n <SheetContent>\n <SheetHeader>\n <SheetTitle>{mode === 'edit' ? 'edit goal' : 'remove goal'}</SheetTitle>\n </SheetHeader>\n <SheetBody>\n {mode === 'edit' ? (\n <>\n <Text style={styles.meta}>\n this replaces the objective the agent is working to. it takes effect on the next turn.\n </Text>\n <Label>objective</Label>\n <Textarea accessibilityLabel=\"objective\" value={draft} onChangeText={setDraft} numberOfLines={3} />\n <Label>token budget</Label>\n <Input\n accessibilityLabel=\"token budget\"\n value={budget}\n onChangeText={setBudget}\n placeholder={`${budgetHintOf(state) || 'none'}; blank keeps it`}\n />\n <Text style={styles.meta}>{command ?? 'nothing to send'}</Text>\n </>\n ) : (\n <Text style={styles.meta}>\n this ends {objective} and stops the current turn. it is archived to this repository's goal history, where\n it can be restarted.\n </Text>\n )}\n {error ? (\n <Text accessibilityRole=\"alert\" style={styles.error}>\n {error}\n </Text>\n ) : null}\n <View style={styles.actions}>\n <Button variant=\"ghost\" onPress={close}>\n cancel\n </Button>\n <Button\n variant={mode === 'edit' ? 'primary' : 'danger'}\n disabled={mode === 'edit' && command === undefined}\n onPress={() => {\n const value = mode === 'edit' ? command : CLEAR_GOAL_COMMAND;\n if (value) submit(value);\n }}\n >\n {mode === 'edit' ? 'save' : 'remove'}\n </Button>\n </View>\n </SheetBody>\n </SheetContent>\n </Sheet>\n );\n}\n\n/** Reads the same status and sends the same validated commands as the cockpit. */\nexport function GoalActivitySection({ sessionId, statuses, sendSessionFrame }: WebPluginSlotProps) {\n const [mode, setMode] = useState<'edit' | 'confirm'>();\n const view = parseGoalStatusView(statuses[GOAL_VIEW_STATUS_KEY]);\n const [error, setError] = useState<string>();\n if (!view) return <Text style={styles.meta}>goal status unavailable</Text>;\n return (\n <View testID=\"activity-goal-row\">\n <ListRow\n title={<Text style={styles.title}>{view.objective}</Text>}\n description={view.state}\n trailing={\n <DropdownMenu>\n <DropdownMenuTrigger\n variant=\"ghost\"\n size=\"icon\"\n accessibilityLabel=\"goal actions\"\n disabled={sessionId === null}\n >\n <KebabIcon />\n </DropdownMenuTrigger>\n <DropdownMenuContent>\n <DropdownMenuItem onSelect={() => setMode('edit')}>edit</DropdownMenuItem>\n <DropdownMenuItem variant=\"destructive\" onSelect={() => setMode('confirm')}>\n remove\n </DropdownMenuItem>\n </DropdownMenuContent>\n </DropdownMenu>\n }\n />\n {error ? <Text style={styles.error}>{error}</Text> : null}\n {mode && sessionId !== null ? (\n <GoalSheet\n key={mode}\n objective={view.objective}\n state={view.state}\n mode={mode}\n error={error}\n close={() => {\n setMode(undefined);\n setError(undefined);\n }}\n submit={(command) => {\n try {\n sendSessionFrame(sessionId, { type: 'prompt', message: command });\n setMode(undefined);\n setError(undefined);\n } catch (failure) {\n setError(failure instanceof Error ? failure.message : String(failure));\n }\n }}\n />\n ) : null}\n </View>\n );\n}\n\nconst styles = StyleSheet.create((theme: PoNativeTheme) => ({\n title: {\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.base,\n lineHeight: theme.lineHeight.base,\n fontWeight: '600',\n color: theme.colors.hi,\n },\n actions: { flexDirection: 'row', justifyContent: 'flex-end', gap: theme.spacing(2) },\n meta: {\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.sm,\n lineHeight: theme.lineHeight.sm,\n color: theme.colors.dim,\n },\n error: { fontSize: theme.fontSize.sm, color: theme.colors.red },\n}));\n","import { defineFill } from '@agimon-ai/po-core/native';\n\nimport { GoalActivitySection } from './_components/GoalActivitySection.native';\n\nexport default defineFill({ component: GoalActivitySection });\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineNativePlugin, type WebPluginContributions } from '@agimon-ai/po-core/native';\n\nimport activityGroupGoal from '../src/extensions/workspaces/sessions/(frontend)/activity-group/goal.native';\nimport fillGoal from '../src/extensions/workspaces/sessions/(frontend)/fill/Goal.activity.goal.native';\n\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T =>\n (value === undefined ? undefined : { ...identity, ...(value as object) }) as T;\n\nexport const nativePlugin = defineNativePlugin({\n id: 'goal',\n session: {\n get activityGroups(): WebPluginContributions['activityGroups'] { return [via({ name: 'goal' }, activityGroupGoal)]; },\n get fills(): WebPluginContributions['fills'] { return [via({ slot: 'activity.goal', id: 'goal' }, fillGoal)]; },\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;AAUA,MAAa,uBAAuB;;;;;;;;AASpC,MAAM,mBAAmB;;AAGzB,MAAM,OAAO;;;;;;AAoBb,SAAgB,oBAAoB,KAAqD;CACvF,IAAI,QAAQ,KAAA,GAAW,OAAO,KAAA;CAC9B,MAAM,OAAO,IAAI,QAAQ,MAAM,EAAE,CAAC,CAAC,KAAK;CACxC,MAAM,MAAM,KAAK,QAAQ,gBAAgB;CACzC,IAAI,QAAQ,IAAI,OAAO,KAAA;CACvB,MAAM,YAAY,KAAK,MAAM,MAAM,CAAuB,CAAC,CAAC,KAAK;CACjE,OAAO,cAAc,KAAK,KAAA,IAAY;EAAE,OAAO,KAAK,MAAM,GAAG,GAAG,CAAC,CAAC,KAAK;EAAG;CAAU;AACtF;;;AC7CA,IAAA,sBAAe,oBAAoB;CACjC,MAAM;CACN,WAAW;CACX,qBAAqB;CACrB,eAAe;CACf,OAAO;AACT,CAAC;;;;;;;;;;;;;;;;;;AEQD,MAAa,qBAAqB;;AAGlC,MAAM,aAAa;;AAGnB,MAAM,eAAe;;;;;;AAOrB,SAAgB,mBAAmB,WAAuC;CACx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AAe;EAAOC,gBAAgB;EAAYC,KAAKb,MAAMc,QAAQ,CAAC;EAACJ,mBAAA,CAAA,CAAA;CAAC;CACnF5B,MAAM;EACJmB,YAAY1C,OAAOyC,MAAMC,WAAWC,IAAI;EACxCC,UAAUH,MAAMG,SAASY;EACzBV,YAAYL,MAAMK,WAAWU;EAC7BR,OAAOP,MAAMQ,OAAOQ;EAAGN,mBAAA,CAAA,CAAA;CACzB;CACApC,OAAO;EAAE6B,UAAUH,MAAMG,SAASY;EAAIR,OAAOP,MAAMQ,OAAOS;EAAGP,mBAAA,CAAA,CAAA;CAAC;AAChE,EAAE;;;AC9KF,IAAA,oCAAe,WAAW,EAAE,WAAW,oBAAoB,CAAC;;;ACE5D,MAAM,OAAU,UAAmC,UAChD,UAAU,KAAA,IAAY,KAAA,IAAY;CAAE,GAAG;CAAU,GAAI;AAAiB;AAEzE,MAAa,eAAe,mBAAmB;CAC7C,IAAI;CACJ,SAAS;EACP,IAAI,iBAA2D;GAAE,OAAO,CAAC,IAAI,EAAE,MAAM,OAAO,GAAGQ,mBAAiB,CAAC;EAAG;EACpH,IAAI,QAAyC;GAAE,OAAO,CAAC,IAAI;IAAE,MAAM;IAAiB,IAAI;GAAO,GAAGC,iCAAQ,CAAC;EAAG;CAChH;AACF,CAAC"}
1
+ {"version":3,"file":"native.mjs","names":["WebPluginSlotProps","Button","DropdownMenu","DropdownMenuTrigger","DropdownMenuContent","DropdownMenuItem","KebabIcon","Input","Label","ListRow","Sheet","SheetContent","SheetHeader","SheetTitle","SheetBody","Textarea","fontOf","PoNativeTheme","useState","StyleSheet","GOAL_VIEW_STATUS_KEY","parseGoalStatusView","budgetHintOf","CLEAR_GOAL_COMMAND","editGoalCommand","GoalSheet","objective","state","mode","submit","close","error","command","draft","setDraft","budget","setBudget","open","styles","meta","actions","undefined","value","GoalActivitySection","sessionId","statuses","sendSessionFrame","setMode","view","setError","title","type","message","failure","Error","String","create","theme","fontFamily","sans","fontSize","base","lineHeight","fontWeight","color","colors","hi","uni__dependencies","flexDirection","justifyContent","gap","spacing","sm","dim","red","activityGroupGoal","fillGoal","fillGoal2"],"sources":["../../src/types/goalView.ts","../../src/extensions/workspaces/sessions/(frontend)/activity-group/goal.native.ts","../../src/types/goal.ts","../../src/extensions/workspaces/sessions/(frontend)/fill/_lib/goalCommands.ts","../../src/extensions/workspaces/sessions/(frontend)/fill/_components/GoalActivitySection.native.tsx","../../src/extensions/workspaces/sessions/(frontend)/fill/Goal.activity.goal.native.tsx","../../src/extensions/workspaces/sessions/(frontend)/fill/_lib/helpGuides.ts","../../src/extensions/workspaces/sessions/(frontend)/fill/Goal.help.guides.native.ts","../../generated/native.ts"],"sourcesContent":["/**\n * The goal the cockpit shows, as it travels.\n *\n * The session has no data channel of its own, so the objective reaches the\n * browser on a footer status the host already relays and replays to a\n * reattaching page. This module is both halves of that wire format: the session\n * writes it, the activity dock reads it, and neither knows the other.\n */\n\n/** The status key the activity group keys off, distinct from the footer's terse `goal`. */\nexport const GOAL_VIEW_STATUS_KEY = 'po-goal-current';\n\n/**\n * Between the state and the objective.\n *\n * An objective may itself contain this sequence, so the split is on the first\n * occurrence rather than the last: the state is the one leading field and\n * everything after it belongs to the goal.\n */\nconst STATUS_SEPARATOR = ' · ';\n\n/** Strips the colour a session may have themed a status with. */\nconst ANSI = /\u001b\\[[0-9;]*m/gu;\n\n/** What a reader gets out of the status line. */\nexport interface GoalStatusView {\n /** How the session words the goal's state, such as `active 12.4k/100k`. */\n state: string;\n /** The objective, as the goal holds it. */\n objective: string;\n}\n\n/** The status line the session publishes for the dock. */\nexport function formatGoalStatusView(objective: string, state: string): string {\n return `${state}${STATUS_SEPARATOR}${objective}`;\n}\n\n/**\n * Reading the status line back. Statuses reach a plugin raw, so the colour a\n * session may have added comes off here. An absent, empty, or objective-less\n * line means there is no goal to draw a row for.\n */\nexport function parseGoalStatusView(raw: string | undefined): GoalStatusView | undefined {\n if (raw === undefined) return undefined;\n const text = raw.replace(ANSI, '').trim();\n const cut = text.indexOf(STATUS_SEPARATOR);\n if (cut === -1) return undefined;\n const objective = text.slice(cut + STATUS_SEPARATOR.length).trim();\n return objective === '' ? undefined : { state: text.slice(0, cut).trim(), objective };\n}\n","import { defineActivityGroup } from '@agimon-ai/po-core/native';\n\nimport { GOAL_VIEW_STATUS_KEY } from '../../../../../types/goalView';\n\nexport default defineActivityGroup({\n keys: 'g e',\n statusKey: GOAL_VIEW_STATUS_KEY,\n marksBackgroundWork: false,\n hideWhenEmpty: true,\n order: 35,\n});\n","export const GOAL_STATUSES = ['active', 'paused', 'blocked', 'usage_limited', 'budget_limited', 'complete'] as const;\n/**\n * The longest objective a goal may hold. A constraint on the text itself rather\n * than on the command that sets it, so the parser, the codec, and the cockpit's\n * edit form all measure against the same number.\n */\nexport const MAX_OBJECTIVE_LENGTH = 4_000;\nexport type GoalStatus = (typeof GOAL_STATUSES)[number];\nexport type SafetyPauseCause = 'continuation_limit' | 'no_progress';\nexport interface ActiveGoal {\n id: string;\n text: string;\n status: GoalStatus;\n startedAt: number;\n updatedAt: number;\n iteration: number;\n tokenBudget?: number;\n tokensUsed: number;\n timeUsedSeconds: number;\n baselineTokens: number;\n activeStartedAt?: number;\n automaticModelTurns: number;\n toolFreeRepeatCount: number;\n lastToolFreeOutputFingerprint?: string;\n safetyPauseCause?: SafetyPauseCause;\n safetyResetPending?: boolean;\n}\nexport interface GoalStateData {\n goal: ActiveGoal | null;\n}\nexport interface LoadedGoalState {\n goal?: ActiveGoal;\n source: 'none' | 'canonical' | 'legacy-goals';\n malformed: boolean;\n}\nexport type GoalExecutionState = 'dormant' | 'executing' | 'retained';\nexport interface GoalRuntimeSnapshot {\n loaded: boolean;\n execution: GoalExecutionState;\n goal?: ActiveGoal;\n}\n","import { MAX_OBJECTIVE_LENGTH } from '../../../../../../types/goal';\n\n/**\n * The slash commands the goal group sends, built in one place.\n *\n * The cockpit drives the goal through the same `/goal` verbs the terminal does\n * rather than through an API of its own, so an edit made here and an edit typed\n * there are one operation. That makes the shape of the command the contract,\n * and this is where it is kept honest: Pi tokenizes a command on whitespace and\n * rejoins on single spaces, so a multi-line objective typed into a textarea\n * would arrive collapsed. Collapsing it here means what the dialog previews is\n * what the goal ends up holding.\n *\n * One thing this cannot smooth over: Pi's tokenizer also strips quotes, so an\n * objective written with them loses them, exactly as it would if it were typed\n * after /goal in the terminal.\n */\n\nexport const CLEAR_GOAL_COMMAND = '/goal clear';\n\n/** Whitespace as Pi's tokenizer sees it: any run of it separates two tokens. */\nconst WHITESPACE = /\\s+/gu;\n\n/** What the session's parseTokenBudget accepts: a count, optionally in thousands or millions. */\nconst TOKEN_BUDGET = /^\\d+(?:\\.\\d+)?[km]?$/iu;\n\n/**\n * The objective as the goal will hold it, or undefined when there is nothing\n * sendable. Repeated and surrounding whitespace goes the way Pi would take it\n * anyway, and an over-long one is refused here rather than after a round trip.\n */\nexport function normalizeObjective(objective: string): string | undefined {\n const collapsed = objective.trim().replaceAll(WHITESPACE, ' ');\n return collapsed === '' || collapsed.length > MAX_OBJECTIVE_LENGTH ? undefined : collapsed;\n}\n\n/**\n * The `/goal edit` a save sends, or undefined while the form cannot make one.\n *\n * A blank budget omits `--tokens`, which is what leaves the goal's current\n * budget alone: the session writes a budget only when the flag is present.\n */\n/**\n * The budget out of a state line, for the edit form's placeholder.\n *\n * The session words a budgeted goal as `used/budget` and an unbudgeted one\n * without a slash, and it abbreviates both the way `--tokens` reads them back,\n * so the tail of that line is already a value the command accepts.\n */\nexport function budgetHintOf(state: string): string {\n const cut = state.indexOf('/');\n return cut === -1 ? '' : state.slice(cut + 1).trim();\n}\n\nexport function editGoalCommand(objective: string, budget: string): string | undefined {\n const text = normalizeObjective(objective);\n if (text === undefined) return undefined;\n const tokens = budget.trim();\n if (tokens === '') return `/goal edit ${text}`;\n return TOKEN_BUDGET.test(tokens) ? `/goal edit --tokens ${tokens} ${text}` : undefined;\n}\n","import type { WebPluginSlotProps } from '@agimon-ai/po-core/native';\nimport {\n Button,\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItem,\n KebabIcon,\n Input,\n Label,\n ListRow,\n Sheet,\n SheetContent,\n SheetHeader,\n SheetTitle,\n SheetBody,\n Textarea,\n fontOf,\n} from '@agimon-ai/po-native-components';\nimport type { PoNativeTheme } from '@agimon-ai/po-web-components/nativeTheme';\nimport { useState } from 'react';\nimport { Text, View } from 'react-native';\nimport { StyleSheet } from 'react-native-unistyles';\n\nimport { GOAL_VIEW_STATUS_KEY, parseGoalStatusView } from '../../../../../../types/goalView';\nimport { budgetHintOf, CLEAR_GOAL_COMMAND, editGoalCommand } from '../_lib/goalCommands';\n\nfunction GoalSheet({\n objective,\n state,\n mode,\n submit,\n close,\n error,\n}: {\n objective: string;\n state: string;\n mode: 'edit' | 'confirm';\n submit: (command: string) => void;\n close: () => void;\n error?: string;\n}) {\n const [draft, setDraft] = useState(objective);\n const [budget, setBudget] = useState('');\n const command = editGoalCommand(draft, budget);\n return (\n <Sheet\n open\n onOpenChange={(open) => {\n if (!open) close();\n }}\n >\n <SheetContent>\n <SheetHeader>\n <SheetTitle>{mode === 'edit' ? 'edit goal' : 'remove goal'}</SheetTitle>\n </SheetHeader>\n <SheetBody>\n {mode === 'edit' ? (\n <>\n <Text style={styles.meta}>\n this replaces the objective the agent is working to. it takes effect on the next turn.\n </Text>\n <Label>objective</Label>\n <Textarea accessibilityLabel=\"objective\" value={draft} onChangeText={setDraft} numberOfLines={3} />\n <Label>token budget</Label>\n <Input\n accessibilityLabel=\"token budget\"\n value={budget}\n onChangeText={setBudget}\n placeholder={`${budgetHintOf(state) || 'none'}; blank keeps it`}\n />\n <Text style={styles.meta}>{command ?? 'nothing to send'}</Text>\n </>\n ) : (\n <Text style={styles.meta}>\n this ends {objective} and stops the current turn. it is archived to this repository's goal history, where\n it can be restarted.\n </Text>\n )}\n {error ? (\n <Text accessibilityRole=\"alert\" style={styles.error}>\n {error}\n </Text>\n ) : null}\n <View style={styles.actions}>\n <Button variant=\"ghost\" onPress={close}>\n cancel\n </Button>\n <Button\n variant={mode === 'edit' ? 'primary' : 'danger'}\n disabled={mode === 'edit' && command === undefined}\n onPress={() => {\n const value = mode === 'edit' ? command : CLEAR_GOAL_COMMAND;\n if (value) submit(value);\n }}\n >\n {mode === 'edit' ? 'save' : 'remove'}\n </Button>\n </View>\n </SheetBody>\n </SheetContent>\n </Sheet>\n );\n}\n\n/** Reads the same status and sends the same validated commands as the cockpit. */\nexport function GoalActivitySection({ sessionId, statuses, sendSessionFrame }: WebPluginSlotProps) {\n const [mode, setMode] = useState<'edit' | 'confirm'>();\n const view = parseGoalStatusView(statuses[GOAL_VIEW_STATUS_KEY]);\n const [error, setError] = useState<string>();\n if (!view) return <Text style={styles.meta}>goal status unavailable</Text>;\n return (\n <View testID=\"activity-goal-row\">\n <ListRow\n title={<Text style={styles.title}>{view.objective}</Text>}\n description={view.state}\n trailing={\n <DropdownMenu>\n <DropdownMenuTrigger\n variant=\"ghost\"\n size=\"icon\"\n accessibilityLabel=\"goal actions\"\n disabled={sessionId === null}\n >\n <KebabIcon />\n </DropdownMenuTrigger>\n <DropdownMenuContent>\n <DropdownMenuItem onSelect={() => setMode('edit')}>edit</DropdownMenuItem>\n <DropdownMenuItem variant=\"destructive\" onSelect={() => setMode('confirm')}>\n remove\n </DropdownMenuItem>\n </DropdownMenuContent>\n </DropdownMenu>\n }\n />\n {error ? <Text style={styles.error}>{error}</Text> : null}\n {mode && sessionId !== null ? (\n <GoalSheet\n key={mode}\n objective={view.objective}\n state={view.state}\n mode={mode}\n error={error}\n close={() => {\n setMode(undefined);\n setError(undefined);\n }}\n submit={(command) => {\n try {\n sendSessionFrame(sessionId, { type: 'prompt', message: command });\n setMode(undefined);\n setError(undefined);\n } catch (failure) {\n setError(failure instanceof Error ? failure.message : String(failure));\n }\n }}\n />\n ) : null}\n </View>\n );\n}\n\nconst styles = StyleSheet.create((theme: PoNativeTheme) => ({\n title: {\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.base,\n lineHeight: theme.lineHeight.base,\n fontWeight: '600',\n color: theme.colors.hi,\n },\n actions: { flexDirection: 'row', justifyContent: 'flex-end', gap: theme.spacing(2) },\n meta: {\n fontFamily: fontOf(theme.fontFamily.sans),\n fontSize: theme.fontSize.sm,\n lineHeight: theme.lineHeight.sm,\n color: theme.colors.dim,\n },\n error: { fontSize: theme.fontSize.sm, color: theme.colors.red },\n}));\n","import { defineFill } from '@agimon-ai/po-core/native';\n\nimport { GoalActivitySection } from './_components/GoalActivitySection.native';\n\nexport default defineFill({ component: GoalActivitySection });\n","/** README-grounded starter guidance shared by the web and native fills. */\nexport const helpGuides = {\n version: 1,\n label: 'Goal',\n guides: [\n {\n id: 'about',\n question: 'What is a goal?',\n order: 0,\n answer:\n 'A goal keeps one objective active across agent turns. An independent check reviews the transcript and verification evidence when the session is idle.',\n },\n {\n id: 'budget',\n question: 'How do I set a goal or token budget?',\n order: 1,\n answer:\n 'Send /goal followed by your objective. For a budget, use /goal --tokens 100k followed by the objective. Budgets also accept values such as 1.5m.',\n keywords: ['limit', 'tokens'],\n },\n ],\n} satisfies {\n version: 1;\n label: string;\n guides: { id: string; question: string; answer: string; keywords?: string[]; order?: number }[];\n};\n","import { defineFill } from '@agimon-ai/po-core/native';\n\nimport { helpGuides } from './_lib/helpGuides';\n\nexport default defineFill({\n slot: 'help.guides',\n id: 'Goal',\n order: 30,\n data: helpGuides,\n});\n","// Generated by @agimon-ai/po-build. Do not edit by hand.\nimport { defineNativePlugin, type WebPluginContributions } from '@agimon-ai/po-core/native';\n\nimport activityGroupGoal from '../src/extensions/workspaces/sessions/(frontend)/activity-group/goal.native';\nimport fillGoal from '../src/extensions/workspaces/sessions/(frontend)/fill/Goal.activity.goal.native';\nimport fillGoal2 from '../src/extensions/workspaces/sessions/(frontend)/fill/Goal.help.guides.native';\n\nconst via = <T>(identity: Record<string, unknown>, value: unknown): T =>\n (value === undefined ? undefined : { ...identity, ...(value as object) }) as T;\n\nexport const nativePlugin = defineNativePlugin({\n id: 'goal',\n session: {\n get activityGroups(): WebPluginContributions['activityGroups'] { return [via({ name: 'goal' }, activityGroupGoal)]; },\n get fills(): WebPluginContributions['fills'] { return [via({ slot: 'activity.goal', id: 'goal' }, fillGoal), via({ slot: 'help.guides', id: 'goal' }, fillGoal2)]; },\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;AAUA,MAAa,uBAAuB;;;;;;;;AASpC,MAAM,mBAAmB;;AAGzB,MAAM,OAAO;;;;;;AAoBb,SAAgB,oBAAoB,KAAqD;CACvF,IAAI,QAAQ,KAAA,GAAW,OAAO,KAAA;CAC9B,MAAM,OAAO,IAAI,QAAQ,MAAM,EAAE,CAAC,CAAC,KAAK;CACxC,MAAM,MAAM,KAAK,QAAQ,gBAAgB;CACzC,IAAI,QAAQ,IAAI,OAAO,KAAA;CACvB,MAAM,YAAY,KAAK,MAAM,MAAM,CAAuB,CAAC,CAAC,KAAK;CACjE,OAAO,cAAc,KAAK,KAAA,IAAY;EAAE,OAAO,KAAK,MAAM,GAAG,GAAG,CAAC,CAAC,KAAK;EAAG;CAAU;AACtF;;;AC7CA,IAAA,sBAAe,oBAAoB;CACjC,MAAM;CACN,WAAW;CACX,qBAAqB;CACrB,eAAe;CACf,OAAO;AACT,CAAC;;;;;;;;;;;;;;;;;;AEQD,MAAa,qBAAqB;;AAGlC,MAAM,aAAa;;AAGnB,MAAM,eAAe;;;;;;AAOrB,SAAgB,mBAAmB,WAAuC;CACxE,MAAM,YAAY,UAAU,KAAK,CAAC,CAAC,WAAW,YAAY,GAAG;CAC7D,OAAO,cAAc,MAAM,UAAU,SAAA,MAAgC,KAAA,IAAY;AACnF;;;;;;;;;;;;;;AAeA,SAAgB,aAAa,OAAuB;CAClD,MAAM,MAAM,MAAM,QAAQ,GAAG;CAC7B,OAAO,QAAQ,KAAK,KAAK,MAAM,MAAM,MAAM,CAAC,CAAC,CAAC,KAAK;AACrD;AAEA,SAAgB,gBAAgB,WAAmB,QAAoC;CACrF,MAA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