@geminixiang/mikan 1.0.0-beta.7 → 1.0.0-beta.9

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.
Files changed (54) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/dist/adapter.d.ts +1 -1
  3. package/dist/adapter.d.ts.map +1 -1
  4. package/dist/adapter.js.map +1 -1
  5. package/dist/adapters/github/bot.d.ts +63 -0
  6. package/dist/adapters/github/bot.d.ts.map +1 -0
  7. package/dist/adapters/github/bot.js +566 -0
  8. package/dist/adapters/github/bot.js.map +1 -0
  9. package/dist/adapters/github/client.d.ts +76 -0
  10. package/dist/adapters/github/client.d.ts.map +1 -0
  11. package/dist/adapters/github/client.js +194 -0
  12. package/dist/adapters/github/client.js.map +1 -0
  13. package/dist/adapters/github/context.d.ts +9 -0
  14. package/dist/adapters/github/context.d.ts.map +1 -0
  15. package/dist/adapters/github/context.js +168 -0
  16. package/dist/adapters/github/context.js.map +1 -0
  17. package/dist/adapters/github/ids.d.ts +25 -0
  18. package/dist/adapters/github/ids.d.ts.map +1 -0
  19. package/dist/adapters/github/ids.js +39 -0
  20. package/dist/adapters/github/ids.js.map +1 -0
  21. package/dist/adapters/github/repo.d.ts +19 -0
  22. package/dist/adapters/github/repo.d.ts.map +1 -0
  23. package/dist/adapters/github/repo.js +58 -0
  24. package/dist/adapters/github/repo.js.map +1 -0
  25. package/dist/adapters/github/types.d.ts +111 -0
  26. package/dist/adapters/github/types.d.ts.map +1 -0
  27. package/dist/adapters/github/types.js +2 -0
  28. package/dist/adapters/github/types.js.map +1 -0
  29. package/dist/agent.d.ts +2 -2
  30. package/dist/agent.d.ts.map +1 -1
  31. package/dist/agent.js +10 -2
  32. package/dist/agent.js.map +1 -1
  33. package/dist/main.js +52 -2
  34. package/dist/main.js.map +1 -1
  35. package/dist/runtime/conversation-runtime.js +1 -1
  36. package/dist/runtime/conversation-runtime.js.map +1 -1
  37. package/dist/runtime/types.d.ts +3 -1
  38. package/dist/runtime/types.d.ts.map +1 -1
  39. package/dist/runtime/types.js.map +1 -1
  40. package/dist/sessions/policy.d.ts.map +1 -1
  41. package/dist/sessions/policy.js +1 -0
  42. package/dist/sessions/policy.js.map +1 -1
  43. package/dist/tools/github-pr.d.ts +22 -0
  44. package/dist/tools/github-pr.d.ts.map +1 -0
  45. package/dist/tools/github-pr.js +53 -0
  46. package/dist/tools/github-pr.js.map +1 -0
  47. package/dist/tools/index.d.ts +2 -1
  48. package/dist/tools/index.d.ts.map +1 -1
  49. package/dist/tools/index.js +4 -0
  50. package/dist/tools/index.js.map +1 -1
  51. package/dist/types.d.ts +20 -1
  52. package/dist/types.d.ts.map +1 -1
  53. package/dist/types.js.map +1 -1
  54. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -9,6 +9,43 @@ any release.
9
9
 
10
10
  ## [Unreleased]
11
11
 
12
+ ## [1.0.0-beta.9]
13
+
14
+ ### Added
15
+
16
+ - Clone GitHub repositories into conversation workspaces and check out pull request heads.
17
+ - Add a `github_pr` tool that pushes agent changes from `pi/*` branches and opens pull requests.
18
+
19
+ ### Changed
20
+
21
+ - Require GitHub App Contents read and write permission for repository automation.
22
+ - Post completed GitHub responses as single comments instead of streaming edits.
23
+
24
+ ### Fixed
25
+
26
+ - Keep GitHub issue context inside the history recency window.
27
+
28
+ ### Security
29
+
30
+ - Require commenters to have repository write permission or higher before triggering the agent.
31
+ - Keep installation tokens out of sandboxes and restrict agent pushes to non-force `pi/*` branches.
32
+
33
+ ### Tests
34
+
35
+ - Add coverage for GitHub repository checkout, permission gating, pull request creation, and branch restrictions.
36
+
37
+ ## [1.0.0-beta.8]
38
+
39
+ ### Added
40
+
41
+ - Add a GitHub messaging adapter where each issue or pull request is an independent conversation.
42
+ - Add GitHub App authentication, mention and participation triggers, persisted polling cursors, and downtime replay.
43
+ - Add GitHub adapter deployment configuration and documentation.
44
+
45
+ ### Tests
46
+
47
+ - Add coverage for GitHub polling, authentication, conversation context, triggers, and responses.
48
+
12
49
  ## [1.0.0-beta.7]
13
50
 
14
51
  ### Added
package/dist/adapter.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export type { MessagingBot, ConversationContext, ConversationEvent, MessagingEventHandler, ChatAdapter, ConversationMessage, ConversationResponder, ChatToolResult, ConversationKind, MessagingInfo, PlatformName, PlatformNotifier, PlatformReactor, RunningSession, } from "./types.js";
1
+ export type { MessagingBot, ConversationContext, ConversationEvent, MessagingEventHandler, ChatAdapter, ConversationMessage, ConversationResponder, ChatToolResult, ConversationKind, GithubPrRequest, GithubPrResult, MessagingInfo, PlatformName, PlatformNotifier, PlatformPrCreator, PlatformReactor, RunningSession, } from "./types.js";
2
2
  //# sourceMappingURL=adapter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,EACrB,WAAW,EACX,mBAAmB,EACnB,qBAAqB,EACrB,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,cAAc,GACf,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,EACrB,WAAW,EACX,mBAAmB,EACnB,qBAAqB,EACrB,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,cAAc,GACf,MAAM,YAAY,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"adapter.js","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"","sourcesContent":["export type {\n MessagingBot,\n ConversationContext,\n ConversationEvent,\n MessagingEventHandler,\n ChatAdapter,\n ConversationMessage,\n ConversationResponder,\n ChatToolResult,\n ConversationKind,\n MessagingInfo,\n PlatformName,\n PlatformNotifier,\n PlatformReactor,\n RunningSession,\n} from \"./types.js\";\n"]}
1
+ {"version":3,"file":"adapter.js","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"","sourcesContent":["export type {\n MessagingBot,\n ConversationContext,\n ConversationEvent,\n MessagingEventHandler,\n ChatAdapter,\n ConversationMessage,\n ConversationResponder,\n ChatToolResult,\n ConversationKind,\n GithubPrRequest,\n GithubPrResult,\n MessagingInfo,\n PlatformName,\n PlatformNotifier,\n PlatformPrCreator,\n PlatformReactor,\n RunningSession,\n} from \"./types.js\";\n"]}
@@ -0,0 +1,63 @@
1
+ import type { ConversationEvent, GithubPrRequest, GithubPrResult, MessagingBot, MessagingEventHandler, MessagingInfo } from "../../adapter.js";
2
+ import { GithubClient } from "./client.js";
3
+ import type { GithubBotConfig, GithubConversationRef } from "./types.js";
4
+ /** GitHub comment bodies cap at 65536 chars; leave headroom for markup. */
5
+ export declare const GITHUB_MAX_COMMENT_LENGTH = 60000;
6
+ export declare const formatGithubContinuation: (partNum: number) => string;
7
+ export declare class GithubMessagingBot implements MessagingBot {
8
+ private readonly client;
9
+ private readonly handler;
10
+ private readonly config;
11
+ private appSlug;
12
+ private botEmail;
13
+ private watchedRepos;
14
+ private queues;
15
+ private repoState;
16
+ private permissionCache;
17
+ private pollInFlight;
18
+ constructor(handler: MessagingEventHandler, config: GithubBotConfig, client?: GithubClient);
19
+ start(): Promise<void>;
20
+ postMessage(channel: string, text: string): Promise<string>;
21
+ updateMessage(channel: string, ts: string, text: string): Promise<void>;
22
+ addReaction(channel: string, messageTs: string, emoji: string): Promise<void>;
23
+ enqueueEvent(event: ConversationEvent): boolean;
24
+ getMessagingInfo(): MessagingInfo;
25
+ postComment(ref: GithubConversationRef, text: string): Promise<number>;
26
+ deleteComment(ref: GithubConversationRef, commentId: number): Promise<void>;
27
+ logToFile(conversationId: string, entry: object): void;
28
+ logBotResponse(conversationId: string, text: string, ts: string): void;
29
+ private getQueue;
30
+ /** One poll tick over every watched repo. Public for tests. */
31
+ poll(): Promise<void>;
32
+ private pollRepo;
33
+ private loadSyncState;
34
+ private persistSyncState;
35
+ /** Fresh regex per call: the `g` flag makes `test`/`replace` stateful. */
36
+ private mentionPattern;
37
+ private isMentioned;
38
+ private stripMention;
39
+ private isParticipating;
40
+ /**
41
+ * True when `user` holds at least write permission on the repo. Fails
42
+ * closed: a failed lookup denies the trigger (and logs) rather than
43
+ * letting an unverified commenter drive the agent.
44
+ */
45
+ private hasTriggerPermission;
46
+ private handleIncoming;
47
+ private logIssueContext;
48
+ private repoDir;
49
+ /**
50
+ * Clone the conversation's repo into its dir (bind-mounted into the
51
+ * sandbox) using an ephemeral contents:read token that never leaves the
52
+ * host. Non-fatal: a failed clone degrades to the pre-clone experience.
53
+ */
54
+ private ensureRepoClone;
55
+ /**
56
+ * Backs the `github_pr` tool: push a `pi/*` branch the agent prepared in
57
+ * the conversation's clone, then open a pull request as the App. The write
58
+ * token is minted per call, scoped to this one repo, and never enters the
59
+ * sandbox.
60
+ */
61
+ pushAndCreatePr(conversationId: string, request: GithubPrRequest): Promise<GithubPrResult>;
62
+ }
63
+ //# sourceMappingURL=bot.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bot.d.ts","sourceRoot":"","sources":["../../../src/adapters/github/bot.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,iBAAiB,EACjB,eAAe,EACf,cAAc,EACd,YAAY,EACZ,qBAAqB,EACrB,aAAa,EACd,MAAM,kBAAkB,CAAC;AAe1B,OAAO,EAAE,YAAY,EAAuB,MAAM,aAAa,CAAC;AAQhE,OAAO,KAAK,EACV,eAAe,EACf,qBAAqB,EAMtB,MAAM,YAAY,CAAC;AAsDpB,2EAA2E;AAC3E,eAAO,MAAM,yBAAyB,QAAQ,CAAC;AAE/C,eAAO,MAAM,wBAAwB,YAAa,MAAM,KAAG,MAAoC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